main search bugs fixed