Update at_exit code