Update index.js

fixes error with none-existent listeners
Merge pull request #7 from copongcopong/master

Update index.js