Fix a bug in index.js