fix shutdown hook