adding shutdown hooks