made the sorting direction optional in the query
copied some tests from 1.2 to 1.2.1