Fixed a typo in an ordering query

I had fixed this in another branch but forgot to add the fix in master.