Fixed some error emits in index.js