Fixed issue where orderBy fails for queries without operands