Fixed handling of the delete event in dialogs