made the crash signal handler safer / more correct