Fixed some bugs when creating a new user