Fixed bugs in ORM.