fix bad sorting