Fix detached head