fixed sorting glitch