Triple query fixes