Fixed refraction calculation bug.