fixed bug with reading metadata