Fixed the cosine function.