workaround to fix javascript error on closing the JQuery-UI dialog.