Fix query parse bug