fix "Maximum call stack size exceeded"