Fixed the write(ByteBuffer) method