hash map output works but not sorted