fix printMap; improve error reporting