improved shutdown