Migrations and some error fixes