Index: /issm/trunk-jpl/src/m/geometry/FlagElements.py
===================================================================
--- /issm/trunk-jpl/src/m/geometry/FlagElements.py	(revision 13502)
+++ /issm/trunk-jpl/src/m/geometry/FlagElements.py	(revision 13503)
@@ -47,5 +47,5 @@
 			else:
 				#ok, flag elements
-				[flag,dum]=ContourToMesh(md.mesh.elements[:,0:3],md.mesh.x.reshape(-1,1),md.mesh.y.reshape(-1,1),region,'element',1)
+				[flag,dum]=ContourToMesh(md.mesh.elements[:,0:3].copy(),md.mesh.x.reshape(-1,1),md.mesh.y.reshape(-1,1),region,'element',1)
 
 		if invert:
Index: /issm/trunk-jpl/src/m/geometry/SegIntersect.py
===================================================================
--- /issm/trunk-jpl/src/m/geometry/SegIntersect.py	(revision 13502)
+++ /issm/trunk-jpl/src/m/geometry/SegIntersect.py	(revision 13503)
@@ -1,4 +1,3 @@
 import numpy
-from MatlabFuncs import *
 
 def SegIntersect(seg1,seg2):
@@ -48,5 +47,5 @@
 
 	#if colinear
-	if test1*test2==0 and test3*test4==0 and det(numpy.hstack((n1.reshape((-1,1)),n2.reshape(-1,1))))==0:
+	if test1*test2==0 and test3*test4==0 and numpy.linalg.det(numpy.hstack((n1.reshape((-1,1)),n2.reshape(-1,1))))==0:
 
 		#projection on the axis O1O2
Index: /issm/trunk-jpl/src/m/parameterization/setflowequation.py
===================================================================
--- /issm/trunk-jpl/src/m/parameterization/setflowequation.py	(revision 13502)
+++ /issm/trunk-jpl/src/m/parameterization/setflowequation.py	(revision 13503)
@@ -123,5 +123,5 @@
 		numnodes2d=md.mesh.numberofvertices2d
 		numlayers=md.mesh.numberoflayers
-		bordernodes2d=numpy.nonzero(numpy.logical_and(nodeonpattyn[1:numnodes2d],nodeonmacayeal[1:numnodes2d]))    #Nodes connected to two different types of elements
+		bordernodes2d=numpy.nonzero(numpy.logical_and(nodeonpattyn[0:numnodes2d],nodeonmacayeal[0:numnodes2d]))[0]+1    #Nodes connected to two different types of elements
 
 		#initialize and fill in penalties structure
@@ -129,5 +129,5 @@
 			penalties=numpy.zeros((0,2))
 			for	i in xrange(1,numlayers):
-				penalties=numpy.vstack((penalties,numpy.hstack((bordernodes2d,bordernodes2d+md.mesh.numberofvertices2d*(i)))))
+				penalties=numpy.vstack((penalties,numpy.hstack((bordernodes2d.reshape(-1,1),bordernodes2d.reshape(-1,1)+md.mesh.numberofvertices2d*(i)))))
 			md.diagnostic.vertex_pairing=penalties
 
