Fix some bugs and add save results button.
Fix uncaught exception and a warning.