writing header_metadata reader