checking if 'profile' exists and setting profile object