Fix the query buil for multiple sort
Merge branch 'multiple-sort-fix' into 2.0-alpha