wrong query bug fixed