bug in index.js