don't sort data when query is nil