Fix some bugs and add SearchMain