minor tweak to sort implementation