Bugfixes for Doctrine support