fixed bugs with map()