Fixed dereferences of NULL pointers in map_remove, map_lookup