Minor query fixes [ci skip]