user model and fix bugs