Fixed an error in the backtracking.