Improve $PROFILE variable and profile loading test
#1832
Merged
$PROFILE variable and profile loading test
#1832