Added two null checks to prevent excpetions when creating a new user account.