model query fixes