make same changes for other sort functions