Index: /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 15786)
+++ /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 15787)
@@ -1014,5 +1014,4 @@
 
 	/*Assign output pointers:*/
-	xDelete<int>(doflist);
 	*pdoflist=doflist;
 }
@@ -2974,7 +2973,5 @@
 void  Penta::ResetCoordinateSystem(void){
 
-	int    approximation;
-	IssmDouble slopex[NUMVERTICES];
-	IssmDouble slopey[NUMVERTICES];
+	int        approximation;
 	IssmDouble xz_plane[6];
 
@@ -2983,10 +2980,15 @@
 	if(IsFloating() || !IsOnBed() || (approximation!=FSApproximationEnum && approximation!=SSAFSApproximationEnum &&  approximation!=HOFSApproximationEnum)) return;
 
+	/*Get number of nodes for velocity only and base*/
+	int         numnodes = this->NumberofNodesVelocity();
+	IssmDouble* slopex   = xNew<IssmDouble>(numnodes);
+	IssmDouble* slopey   = xNew<IssmDouble>(numnodes);
+
 	/*Get slope on each node*/
-	GetInputListOnVertices(&slopex[0],BedSlopeXEnum);
-	GetInputListOnVertices(&slopey[0],BedSlopeYEnum);
-
-	/*Loop over basal nodes (first 3) and update their CS*/
-	for(int i=0;i<NUMVERTICES2D;i++){
+	GetInputListOnNodes(slopex,BedSlopeXEnum);
+	GetInputListOnNodes(slopey,BedSlopeYEnum);
+
+	/*Loop over basal nodes and update their CS*/
+	for(int i=0;i<3;i++){//FIXME
 
 		/*New X axis             New Z axis*/
@@ -2997,4 +2999,8 @@
 		XZvectorsToCoordinateSystem(&this->nodes[i]->coord_system[0][0],&xz_plane[0]);
 	}
+
+	/*cleanup*/
+	xDelete<IssmDouble>(slopex);
+	xDelete<IssmDouble>(slopey);
 }
 /*}}}*/
@@ -10048,4 +10054,5 @@
 	xDelete<int>(doflistm);
 	xDelete<int>(doflists);
+	xDelete<int>(doflistpressure);
 }
 /*}}}*/
