proper handling for crashes