fix the stack overflow problem.