fix Javascript to mimick Coderunner Node.js