fix crash when crashing