Fixed hang at exit