fixed ByteBuffer management

this should be (.position 0) to ensure the buffer is at the beginning
Merge pull request #12 from anthonyurena/master

fixed ByteBuffer management