--- embedaddon/libxml2/xmlschemas.c	2012/02/21 23:37:58	1.1
+++ embedaddon/libxml2/xmlschemas.c	2013/07/22 01:22:18	1.1.1.2
@@ -13946,7 +13946,7 @@ xmlSchemaCheckCOSNSSubset(xmlSchemaWildcardPtr sub,
     */
     if ((sub->negNsSet != NULL) &&
 	(super->negNsSet != NULL) &&
-	(sub->negNsSet->value == sub->negNsSet->value))
+	(sub->negNsSet->value == super->negNsSet->value))
 	return (0);
     /*
     * 3.1 sub must be a set whose members are either namespace names or �absent�.
@@ -15156,9 +15156,10 @@ xmlSchemaCheckSTPropsCorrect(xmlSchemaParserCtxtPtr ct
 	FREE_AND_NULL(str)
 	return (XML_SCHEMAP_ST_PROPS_CORRECT_1);
     }
-    if ( (WXS_IS_LIST(type) || WXS_IS_UNION(type)) &&
-	 (WXS_IS_RESTRICTION(type) == 0) &&
-	 (! WXS_IS_ANY_SIMPLE_TYPE(baseType))) {
+    if ((WXS_IS_LIST(type) || WXS_IS_UNION(type)) &&
+	(WXS_IS_RESTRICTION(type) == 0) &&
+	((! WXS_IS_ANY_SIMPLE_TYPE(baseType)) &&
+         (baseType->type != XML_SCHEMA_TYPE_SIMPLE))) {
 	xmlSchemaPCustomErr(ctxt,
 	    XML_SCHEMAP_ST_PROPS_CORRECT_1,
 	    WXS_BASIC_CAST type, NULL,
@@ -18475,8 +18476,8 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt
 		    particle->children->children =
 			(xmlSchemaTreeItemPtr) xmlSchemaAddParticle(pctxt,
 			type->node,
-			((xmlSchemaParticlePtr) type->subtypes)->minOccurs,
-			((xmlSchemaParticlePtr) type->subtypes)->maxOccurs);
+			((xmlSchemaParticlePtr) baseType->subtypes)->minOccurs,
+			((xmlSchemaParticlePtr) baseType->subtypes)->maxOccurs);
 		    if (particle->children->children == NULL)
 			goto exit_failure;
 		    particle = (xmlSchemaParticlePtr)