fix bugs in apicontroller, create migration for user