fix issue #2 (stuck on exit)