fixed the sin(x)^2 problem