Bug fix in search query