fixed cosine 90 degrees issue