Added error checking for if the last profile no longer exists.