Bug fix in index.js