Fixed the wrong assignations to type, metadataType.