Fixed the map function