fix the reset HEAD problem