fixed a bug upon closing the dialog