Fixed trig bug divide by zero