fix detached head