proper prepareQuery