Update index.js

fixed buffer issues