Fix some bugs when testing ui.