Fixing ByteBuffer to byte array conversion to get rid of trailing null
bytes.