writing bytebuffer