add cleanup hooks.