Fix bug to make metadata compatible with C++ lib

Hi Daniel, 

I have corrected the metadata storage with little endianess so that the metadata gets read in correctly in the C++ layer (as explained in the mail) and vice versa.

Thanks,
Samit.