improve readMetadataAndBody