Fixed javascript bug in index.js