Fixed a problem with the acos function returning NaN