fix order of arguments for query.all