CGIV-1937 moved writing to .profile into ruby block so it's successfully executed