Fixed sort_by with ascending or descending