Improve handling of fatal signals and unhandled exceptions