Fix bug in map implementation