added shutdown hook