Fix call stack size exceeded issue.