db sort order fix