Fix ORM errors