metadata reading and writing