fixed ordering of debug message to prevent crash when dialog is aborted