fix parsing of query type