fix "call stack size exceeded"