fix bug in metadata_reader; change the constructor