fixed bug and refactored how profile_name is created