Fix issue detecting the query type.