fixing javascript errors in math.js