Fix shutdown hooks.