Fixed invalid string type in writeMetadata()