Bug fixed on exit