Corrected sorting in case of no weight