fixing sorting