Fixed math.fmod domain errors