improve map error checking