database migrations and bug fixes