Improved error messages and unit tests in BaseGroupedMapper, fixed CS