minor tweak to ip sort logic.