Fix CachingMapperMixin to deal with non-hashable types