Deal with all kinds of crash or exit