Fix bug to make metadata compatible with C++ lib

Correct the metadata storage with little endianess so that the metadata gets read in correctly in the C++ layer