Added null check to type discovery in MetaDataRegistry