Index: /issm/trunk/src/m/classes/public/bamg.m
===================================================================
--- /issm/trunk/src/m/classes/public/bamg.m	(revision 3267)
+++ /issm/trunk/src/m/classes/public/bamg.m	(revision 3268)
@@ -89,5 +89,5 @@
 		nods=domain(i).nods-1; %the domain are closed 1=end;
 		bamg_geometry.Vertices=[bamg_geometry.Vertices; [domain(i).x(1:nods) domain(i).y(1:nods) ones(nods,1)]];
-		bamg_geometry.Edges=[bamg_geometry.Edges; [transp(count+1:count+nods) transp([count+2:count+nods count+1])  1*ones(nods,1)]];
+		bamg_geometry.Edges=[bamg_geometry.Edges; [transpose(count+1:count+nods) transpose([count+2:count+nods count+1])  1*ones(nods,1)]];
 
 		%update counter
@@ -165,5 +165,5 @@
 						bamg_geometry.Edges=[bamg_geometry.Edges;...
 							count  count+1  2 ;...
-							[transp(count+1:count+nods-1) transp([count+2:count+nods])  2*ones(nods-1,1)]];
+							[transpose(count+1:count+nods-1) transpose([count+2:count+nods])  2*ones(nods-1,1)]];
 						count=count+nods;
 
@@ -174,5 +174,5 @@
 				nods=rift(i).nods-1;
 				bamg_geometry.Vertices=[bamg_geometry.Vertices; [rift(i).x(:) rift(i).y(:) ones(nods+1,1)]];
-				bamg_geometry.Edges=[bamg_geometry.Edges; [transp(count+1:count+nods) transp([count+2:count+nods+1])  2*ones(nods,1)]];
+				bamg_geometry.Edges=[bamg_geometry.Edges; [transpose(count+1:count+nods) transpose([count+2:count+nods+1])  2*ones(nods,1)]];
 				count=count+nods+1;
 			end
Index: /issm/trunk/src/m/classes/public/mesh/rifts/meshprocessoutsiderifts.m
===================================================================
--- /issm/trunk/src/m/classes/public/mesh/rifts/meshprocessoutsiderifts.m	(revision 3267)
+++ /issm/trunk/src/m/classes/public/mesh/rifts/meshprocessoutsiderifts.m	(revision 3268)
@@ -15,4 +15,5 @@
 
 	rift=md.rifts(i);
+	rift.segments;
 	tips=rift.tips;
 	outsidetips=tips(find(flags(rift.tips)==0));
@@ -24,6 +25,12 @@
 		%find tip in the segments, take first segment (there should be 2) that holds tip, 
 		%and grid_connected_to_tip is the other node on this segment:
-		tipindex=find(rift.segments(:,1)==tip); tipindex=tipindex(1);
-		grid_connected_to_tip=rift.segments(tipindex,2);
+		tipindex=find(rift.segments(:,1)==tip); 
+		if length(tipindex),
+			tipindex=tipindex(1);
+			grid_connected_to_tip=rift.segments(tipindex,2);
+		else
+			tipindex=find(rift.segments(:,2)==tip); tipindex=tipindex(1);
+			grid_connected_to_tip=rift.segments(tipindex,1);
+		end
 
 		%ok, we have the tip node, and the first node connected to it, on the rift. Now, 
Index: /issm/trunk/src/m/classes/public/mesh/rifts/meshprocessrifts.m
===================================================================
--- /issm/trunk/src/m/classes/public/mesh/rifts/meshprocessrifts.m	(revision 3267)
+++ /issm/trunk/src/m/classes/public/mesh/rifts/meshprocessrifts.m	(revision 3268)
@@ -25,4 +25,5 @@
 
 [md.elements,md.x,md.y,md.segments,md.segmentmarkers,md.rifts]=TriMeshProcessRifts(md.elements,md.x,md.y,md.segments,md.segmentmarkers);
+
 
 %Fill in rest of fields:
