Update main.js: compatibility with cpu.js