More db query fixes