fixed bug with overlaping queries