updated app.js and index.js to fix a bug