fix the go back in the backtracking