Fixed bug in orm relations