query bug fix.