Fixed index.js for registered users