corrected sum ordering