fix sort helper