fixed weird error of stack too deep