fixed shutdown hook