fixed a bug in query rendering

The 'query' key might not be there