correctly sorting