Index: /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 26691)
+++ /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 26692)
@@ -1247,5 +1247,4 @@
 
    /*Weights*/
-   Gauss* gauss = NULL;
    IssmDouble loadweights_g[NUMVERTICES2D];
    IssmDouble total_weight = 0;
@@ -1292,9 +1291,9 @@
 		else _error_("case not possible");
 	}
-	if(trapezeisnegative) phi = 1-f1*f2;
+	if(trapezeisnegative) phi = 1.-f1*f2;
 	else                  phi = f1*f2;
 	
 	/*Compute weights*/
-	gauss = this->NewGauss(point,f1,f2,1-trapezeisnegative,2);
+	Gauss* gauss = this->NewGauss(point,f1,f2,1-trapezeisnegative,2);
 
 	total_weight = 0.0;
@@ -1305,11 +1304,9 @@
 		total_weight += gauss->weight;
 	}
+	delete gauss;
 
 	/*Normalizing to phi such that weights provide coefficients for integration over subelement (for averaging:phi*weights)*/
-   if(total_weight>0.) for(int i=0;i<NUMVERTICES;i++) weights[i] = weights[i]*phi/total_weight;
+   if(total_weight>0.) for(int i=0;i<NUMVERTICES2D;i++) weights[i] = weights[i]*phi/total_weight;
 	else for(int i=0;i<NUMVERTICES2D;i++) weights[i] = 0.0;
-
-	/*Cleanup*/
-	delete gauss;
 	
 	/*Assign output pointers*/
@@ -2201,5 +2198,5 @@
 			lsf2d[i]   = lsf[i];
 		}
-		GetFractionGeometry2D(weights,&phi,&point,&f1,&f2,&istrapneg,lsf2d);
+		GetFractionGeometry2D(&weights[0],&phi,&point,&f1,&f2,&istrapneg,lsf2d);
 		
 		IssmDouble basetot;
