Added error checking to profile edit