Fixed bug in ORM