Fix query_spec