fix bugs and close dialog