Fixed bugs for constant folding.