bug fix for ordering