bug fix in index.js