cosine fix