fixed a sorting issue (sorted in reverse order)