convert to tree map to ensure sorting