Fixed a number of search bugs