Sorting collision bug