change replacement of code in canvas.js