Changed position of exitHandler call