merge upstream query fixes