Fix check in map null pointer error