query bug fixed