fix backtracking step