Fix query commands