made it work in lua5.2

* math.mod was renamed to math.fmod
* also made significant performance micro-optimization!!1!