Fix crash folding trig functions.