Fix ORM upgrade