fixed bugs in search query