Fix to database models and context