fixed a bug in query rendering

The 'ordering' key might not be there