Bug fixes for search engine