added error check for profile