Fixed a bug in NodeJS when running the method replaceCanvas