fix not stopping application on exit