Index: /issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 4422)
+++ /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 4423)
@@ -158,4 +158,5 @@
 	char* marshalled_dataset=NULL;
 	int   i;
+	int flaghook;
 
 	/*recover marshalled_dataset: */
@@ -172,6 +173,10 @@
 	/*demarshall hooks: */
 	for(i=0;i<numanalyses;i++){
-		hnodes[i]=new Hook();
-		hnodes[i]->Demarshall(&marshalled_dataset);
+		memcpy(&flaghook,marshalled_dataset,sizeof(flaghook));marshalled_dataset+=sizeof(flaghook);
+		if(flaghook){ // there is a hook so demarshall it
+			hnodes[i]=new Hook();
+			hnodes[i]->Demarshall(&marshalled_dataset);
+		}
+		else hnodes[i]=NULL; //There is no hook so it is NULL
 	}
 	hmatice=new Hook(); hmatice->Demarshall(&marshalled_dataset);
@@ -225,4 +230,5 @@
 	char* marshalled_results=NULL;
 	int   marshalled_results_size;
+	int   flaghook; //to indicate if hook is NULL or exists
 
 	/*recover marshalled_dataset: */
@@ -240,5 +246,17 @@
 
 	/*Marshall hooks: */
-	for(i=0;i<numanalyses;i++)hnodes[i]->Marshall(&marshalled_dataset);
+	for(i=0;i<numanalyses;i++){
+		if(hnodes[i]){
+			/*Set flag to 1 as there is a hook */
+			flaghook=1;
+			memcpy(marshalled_dataset,&flaghook,sizeof(flaghook));marshalled_dataset+=sizeof(flaghook);
+			hnodes[i]->Marshall(&marshalled_dataset);
+		}
+		else{
+			/*Set flag to 0 and do not marshall flag as there is no Hook */
+			flaghook=0;
+			memcpy(marshalled_dataset,&flaghook,sizeof(flaghook));marshalled_dataset+=sizeof(flaghook);
+		}
+	}
 	hmatice->Marshall(&marshalled_dataset);
 	hmatpar->Marshall(&marshalled_dataset);
@@ -271,5 +289,8 @@
 	int hnodes_size=0;;
 
-	for(i=0;i<numanalyses;i++)hnodes_size+=hnodes[i]->MarshallSize();
+	for(i=0;i<numanalyses;i++){
+		hnodes_size+=sizeof(int); //Flag 0 or 1
+		if (hnodes[i]) hnodes_size+=hnodes[i]->MarshallSize();
+	}
 
 	return sizeof(id)
