Index: /issm/trunk/src/c/modules/SystemMatricesx/SystemMatricesx.cpp
===================================================================
--- /issm/trunk/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 5781)
+++ /issm/trunk/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 5782)
@@ -42,9 +42,8 @@
 	fsize=nodes->NumberOfDofs(configuration_type,FsetEnum);
 	ssize=nodes->NumberOfDofs(configuration_type,SsetEnum);
+
 	numberofdofspernode=nodes->MaxNumDofs(configuration_type,GsetEnum);
 
 	/*Checks in debugging mode {{{1*/
-	ISSMASSERT(*pKgg==NULL);
-	ISSMASSERT(*ppg==NULL);
 	if(penalty_kflag)ISSMASSERT(kflag);
 	if(penalty_pflag)ISSMASSERT(pflag);
@@ -90,5 +89,6 @@
 	if(pflag){
 
-		pg=NewVec(gsize);
+		if(!buildkff)pg=NewVec(gsize);
+		else         pf=NewVec(fsize);
 
 		/*Fill right hand side vector, from elements: */
@@ -114,11 +114,10 @@
 	}
 
-	
+	/*Now, figure out maximum value of K_gg, so that we can penalize it correctly: */
+	if(!buildkff)MatNorm(Kgg,NORM_INFINITY,&kmax);
+	else MatNorm(Kff,NORM_INFINITY,&kmax);
+
 	/*Now, deal with penalties*/
 	if(penalty_kflag){
-
-		/*Now, figure out maximum value of K_gg, so that we can penalize it correctly: */
-		if(!buildkff)MatNorm(Kgg,NORM_INFINITY,&kmax);
-		else MatNorm(Kff,NORM_INFINITY,&kmax);
 
 		/*Fill stiffness matrix from loads: */
