Corrected sort problem