remove OnCriticalError and DefineCriticalErrorAction