Fix stack overflow bug in ConstantEvaluator pointed out by Dan DaCosta