Fixing on_exit().