fix callback timing of queries