fix wrong usage of map

if  the path is not in the map, this function will insert 2 pairs into the map.