Fixed bugs in Dialog

Fixed bugs in Dialog