Fixed a few entity mapping bugs.