fixing some bugs in search engine