Sort the map correctly