Fixed bugs with dialog.