To cut a long story short I have found the solution by myself.
We should use "tokenat(CanvasSnapshot,1,",")" instead of just "CansavSnapshot".
Also we should find "writefile" function in "c2runtime.js", go 5 steps down and change "UTF8" with "Base64"