Fix version's insert into database
Fix registration and login
Refactor models