fix queries bug