fix the sorting