orm tests and fixes