fixing query ordering in tests