bugfixes for the orm