fixing math.js errors