Fixed small bugs with js dialogs. Issue #17.