correcting index.js null erro