Fixed bugs in user model