add result dialog. fix bugs.