Correct the usage of ByteBuffer