Fix mapping bugs