fixed invalid buildup of search query in some cases