fixed backtrack bug