Fix ordered query

This is what happens when you push untested code :(