Update index.js to fix undefined problem when run on node 10.22