attempts at fixing sorting

attempts at fixing sorting