Fix the cos function