fix detached head situation