fixed unexpected dialog closing