Cleanup hooks on error