Update index.js

Fixes a global leak. HT @ananthakumaran