Bug fixes in dialog.js