minor fix and sorting