diff --git a/lib/bsp_loader/src/brush.rs b/lib/bsp_loader/src/brush.rs
index e356c82..78706b2 100644
--- a/lib/bsp_loader/src/brush.rs
+++ b/lib/bsp_loader/src/brush.rs
@@ -87,7 +87,7 @@ fn planes_to_faces(face_list:std::collections::HashSet<Face>)->Result<Faces,Plan
 					// dont' try to replace face0 because we are exploring that face in particular
 					if let Some(new_intersection)=solve3(face0,new_face,face2){
 						// face1 does not occlude (or intersect) the new intersection
-						if (face1.dot.fix_2()/Planar64::ONE).gt_ratio(face1.normal.dot(intersection.num)/intersection.den){
+						if (face1.dot.fix_2()/Planar64::ONE).gt_ratio(face1.normal.dot(new_intersection.num)/new_intersection.den){
 							remaining_face_refs.remove(new_face);
 							face1=new_face;
 							intersection=new_intersection;
@@ -96,7 +96,7 @@ fn planes_to_faces(face_list:std::collections::HashSet<Face>)->Result<Faces,Plan
 					}
 					if let Some(new_intersection)=solve3(face0,face1,new_face){
 						// face2 does not occlude (or intersect) the new intersection
-						if (face2.dot.fix_2()/Planar64::ONE).gt_ratio(face2.normal.dot(intersection.num)/intersection.den){
+						if (face2.dot.fix_2()/Planar64::ONE).gt_ratio(face2.normal.dot(new_intersection.num)/new_intersection.den){
 							remaining_face_refs.remove(new_face);
 							face2=new_face;
 							intersection=new_intersection;
@@ -123,7 +123,7 @@ fn planes_to_faces(face_list:std::collections::HashSet<Face>)->Result<Faces,Plan
 			}
 			if let Some(new_intersection)=solve3(new_face,face1,face2){
 				// face0 does not occlude (or intersect) the new intersection
-				if (face0.dot.fix_2()/Planar64::ONE).lt_ratio(face0.normal.dot(intersection.num)/intersection.den){
+				if (face0.dot.fix_2()/Planar64::ONE).lt_ratio(face0.normal.dot(new_intersection.num)/new_intersection.den){
 					// abort! reject face0 entirely
 					continue 'face;
 				}
@@ -142,6 +142,11 @@ fn planes_to_faces(face_list:std::collections::HashSet<Face>)->Result<Faces,Plan
 			// problem: this may push a vertex that does not fit in the fixed point range and is thus meaningless
 			face.push(intersection.divide().fix_1());
 
+			// we looped back around to face1, we're done!
+			if core::ptr::eq(face1,face2){
+				break;
+			}
+
 			// the measure
 			let edge_dir=face0.normal.cross(face2.normal);
 
@@ -166,11 +171,6 @@ fn planes_to_faces(face_list:std::collections::HashSet<Face>)->Result<Faces,Plan
 				Some((new_face,new_intersection,d_new_intersection))
 			}).min_by_key(|&(_,_,d)|d).ok_or(PlanesToFacesError::FindNewIntersection)?;
 
-			// we looped back around to face1, we're done!
-			if core::ptr::eq(face1,new_face){
-				break;
-			}
-
 			face2=new_face;
 			intersection=new_intersection;
 		}
@@ -187,6 +187,19 @@ fn planes_to_faces(face_list:std::collections::HashSet<Face>)->Result<Faces,Plan
 	}
 }
 
+#[test]
+fn test_planes_to_faces(){
+	let face_list=[
+		Face{normal:integer::vec3::X,dot:Planar64::ONE},
+		Face{normal:integer::vec3::Y,dot:Planar64::ONE},
+		Face{normal:integer::vec3::Z,dot:Planar64::ONE},
+		Face{normal:integer::vec3::NEG_X,dot:Planar64::ONE},
+		Face{normal:integer::vec3::NEG_Y,dot:Planar64::ONE},
+		Face{normal:integer::vec3::NEG_Z,dot:Planar64::ONE},
+	].into_iter().collect();
+	let faces=planes_to_faces(face_list).unwrap();
+}
+
 #[derive(Debug)]
 pub enum BrushToMeshError{
 	SliceBrushSides,