Index: /issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 3823)
+++ /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 3824)
@@ -58,6 +58,17 @@
 	penta_matice_id=index+1; //refers to the corresponding ice material object
 	penta_matpar_id=iomodel->numberofelements+1; //refers to the constant material parameters object
-	penta_elements_ids[0]=(int)(iomodel->upperelements[index]);
-	penta_elements_ids[1]=(int)(iomodel->lowerelements[index]);
+
+	if isnan(iomodel->upperelements[index]){
+		penta_elements_ids[0]=this->id; //upper penta is the same penta
+	}
+	else{
+		penta_elements_ids[0]=(int)(iomodel->upperelements[index]);
+	}
+	if isnan(iomodel->lowerelements[index]){
+		penta_elements_ids[1]=this->id; //lower penta is the same penta
+	}
+	else{
+		penta_elements_ids[1]=(int)(iomodel->lowerelements[index]);
+	}
 
 	this->InitHookNodes(penta_node_ids); this->nodes=NULL;
