Index: /issm/trunk/src/c/DataSet/DataSet.cpp
===================================================================
--- /issm/trunk/src/c/DataSet/DataSet.cpp	(revision 3475)
+++ /issm/trunk/src/c/DataSet/DataSet.cpp	(revision 3476)
@@ -965,5 +965,5 @@
 
 	/*Check that dofcount is positive*/
-	ISSMASSERT(dofcount>0);
+	if (Size()) ISSMASSERT(dofcount>0);
 
 	/*Ok, now every object has distributed dofs, but locally, and with a dof count starting from 
Index: /issm/trunk/src/c/Dofx/Dofx.cpp
===================================================================
--- /issm/trunk/src/c/Dofx/Dofx.cpp	(revision 3475)
+++ /issm/trunk/src/c/Dofx/Dofx.cpp	(revision 3476)
@@ -27,4 +27,7 @@
 	DofVec* partition=NULL;
 	DofVec* tpartition=NULL;
+
+	/*Check that vertices and nodes are not empty*/
+	ISSMASSERT(nodes && vertices);
 
 	/*Initialize dofvecs: */
Index: /issm/trunk/src/c/ModelProcessorx/Balancedthickness/CreateElementsNodesAndMaterialsBalancedthickness.cpp
===================================================================
--- /issm/trunk/src/c/ModelProcessorx/Balancedthickness/CreateElementsNodesAndMaterialsBalancedthickness.cpp	(revision 3475)
+++ /issm/trunk/src/c/ModelProcessorx/Balancedthickness/CreateElementsNodesAndMaterialsBalancedthickness.cpp	(revision 3476)
@@ -12,7 +12,5 @@
 #include "../IoModel.h"
 
-
 void	CreateElementsNodesAndMaterialsBalancedthickness(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
-
 
 	/*Intermediary*/
Index: /issm/trunk/src/c/ModelProcessorx/DiagnosticHoriz/CreateElementsNodesAndMaterialsDiagnosticHoriz.cpp
===================================================================
--- /issm/trunk/src/c/ModelProcessorx/DiagnosticHoriz/CreateElementsNodesAndMaterialsDiagnosticHoriz.cpp	(revision 3475)
+++ /issm/trunk/src/c/ModelProcessorx/DiagnosticHoriz/CreateElementsNodesAndMaterialsDiagnosticHoriz.cpp	(revision 3476)
@@ -22,7 +22,4 @@
 	DataSet*    vertices = NULL;
 	DataSet*    materials = NULL;
-	
-	/*Now, is the flag macayaealpattyn on? otherwise, do nothing: */
-	if (!iomodel->ismacayealpattyn)goto cleanup_and_return;
 
 	/*First create the elements, nodes and material properties: */
@@ -31,4 +28,7 @@
 	vertices  = new DataSet(VerticesEnum());
 	materials = new DataSet(MaterialsEnum());
+	
+	/*Now, is the flag macayaealpattyn on? otherwise, do nothing: */
+	if (!iomodel->ismacayealpattyn)goto cleanup_and_return;
 
 	/*Partition elements and vertices and nodes: */
Index: /issm/trunk/src/c/ModelProcessorx/DiagnosticHutter/CreateElementsNodesAndMaterialsDiagnosticHutter.cpp
===================================================================
--- /issm/trunk/src/c/ModelProcessorx/DiagnosticHutter/CreateElementsNodesAndMaterialsDiagnosticHutter.cpp	(revision 3475)
+++ /issm/trunk/src/c/ModelProcessorx/DiagnosticHutter/CreateElementsNodesAndMaterialsDiagnosticHutter.cpp	(revision 3476)
@@ -22,4 +22,10 @@
 	DataSet*    vertices = NULL;
 	DataSet*    materials = NULL;
+
+	/*First create the elements, nodes and material properties: */
+	elements  = new DataSet(ElementsEnum());
+	nodes     = new DataSet(NodesEnum());
+	vertices  = new DataSet(VerticesEnum());
+	materials = new DataSet(MaterialsEnum());
 
 	/*Now, is the flag ishutter on? otherwise, do nothing: */
Index: /issm/trunk/src/c/ModelProcessorx/DiagnosticStokes/CreateElementsNodesAndMaterialsDiagnosticStokes.cpp
===================================================================
--- /issm/trunk/src/c/ModelProcessorx/DiagnosticStokes/CreateElementsNodesAndMaterialsDiagnosticStokes.cpp	(revision 3475)
+++ /issm/trunk/src/c/ModelProcessorx/DiagnosticStokes/CreateElementsNodesAndMaterialsDiagnosticStokes.cpp	(revision 3476)
@@ -23,15 +23,4 @@
 	DataSet*    vertices = NULL;
 	DataSet*    materials = NULL;
-	
-	/*Objects: */
-	Node*       node   = NULL;
-	Vertex*     vertex = NULL;
-	Penta*      penta = NULL;
-	Matice*     matice  = NULL;
-	Matpar*     matpar  = NULL;
-
-	/*Now, do we have Stokes elements?*/
-	if (strcmp(iomodel->meshtype,"2d")==0) ISSMERROR("Stokes elements only supported in 3d!");
-	if (!iomodel->isstokes)goto cleanup_and_return;
 
 	/*First create the elements, nodes and material properties: */
@@ -40,4 +29,9 @@
 	vertices  = new DataSet(VerticesEnum());
 	materials = new DataSet(MaterialsEnum());
+
+	/*Now, do we have Stokes elements?*/
+	if (strcmp(iomodel->meshtype,"2d")==0) goto cleanup_and_return;
+	if (!iomodel->isstokes)                goto cleanup_and_return;
+
 
 	/*Partition elements and vertices and nodes: */
Index: /issm/trunk/src/c/ModelProcessorx/DiagnosticVert/CreateElementsNodesAndMaterialsDiagnosticVert.cpp
===================================================================
--- /issm/trunk/src/c/ModelProcessorx/DiagnosticVert/CreateElementsNodesAndMaterialsDiagnosticVert.cpp	(revision 3475)
+++ /issm/trunk/src/c/ModelProcessorx/DiagnosticVert/CreateElementsNodesAndMaterialsDiagnosticVert.cpp	(revision 3476)
@@ -23,7 +23,4 @@
 	DataSet*    materials = NULL;
 
-	/*Now, is the flag macayaealpattyn on? otherwise, do nothing: */
-	if (strcmp(iomodel->meshtype,"2d")==0)goto cleanup_and_return;
-
 	/*First create the elements, nodes and material properties: */
 	elements  = new DataSet(ElementsEnum());
@@ -31,4 +28,7 @@
 	vertices  = new DataSet(VerticesEnum());
 	materials = new DataSet(MaterialsEnum());
+
+	/*Now, is the flag macayaealpattyn on? otherwise, do nothing: */
+	if (strcmp(iomodel->meshtype,"2d")==0)goto cleanup_and_return;
 
 	/*Partition elements and vertices and nodes: */
Index: /issm/trunk/src/c/ModelProcessorx/Melting/CreateElementsNodesAndMaterialsMelting.cpp
===================================================================
--- /issm/trunk/src/c/ModelProcessorx/Melting/CreateElementsNodesAndMaterialsMelting.cpp	(revision 3475)
+++ /issm/trunk/src/c/ModelProcessorx/Melting/CreateElementsNodesAndMaterialsMelting.cpp	(revision 3476)
@@ -14,5 +14,5 @@
 void	CreateElementsNodesAndMaterialsMelting(DataSet** pelements,DataSet** pnodes, DataSet** pvertices,DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
 
-	/*output: int* epart, int* my_grids, double* my_bordergrids*/
+	/*Intermediary*/
 	int i,j,k,n;
 
Index: /issm/trunk/src/c/ModelProcessorx/Thermal/CreateElementsNodesAndMaterialsThermal.cpp
===================================================================
--- /issm/trunk/src/c/ModelProcessorx/Thermal/CreateElementsNodesAndMaterialsThermal.cpp	(revision 3475)
+++ /issm/trunk/src/c/ModelProcessorx/Thermal/CreateElementsNodesAndMaterialsThermal.cpp	(revision 3476)
@@ -14,5 +14,5 @@
 void	CreateElementsNodesAndMaterialsThermal(DataSet** pelements,DataSet** pnodes, DataSet** pvertices,DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){
 
-	/*output: int* epart, int* my_grids, double* my_bordergrids*/
+	/*Intermediary*/
 	int i,j,k,n;
 
