fixed bug that repeated queries