MetadataFactory fixes (work in progress)