tested and fixed user creation  code