Make sure the mapper is an instance of mapper, otherwise throw exception