diff --git a/ptx_twomasks.cc b/ptx_twomasks.cc
index 68818b03a934d26b0998a50d1675c231bd1f3f6b..a750178898beadd4491fb233cb7fe9009cf00861 100644
--- a/ptx_twomasks.cc
+++ b/ptx_twomasks.cc
@@ -38,10 +38,12 @@ void twomasks()
       }
     }
   }
+  cout<<"finished a"<<endl;
   stline.pop_waymasks();
-  
+  cout<<"popped"<<endl;
   
   stline.add_waymask(seeds);
+  
   for(int z=0;z<seeds2.zsize();z++){
     for(int y=0;y<seeds2.ysize();y++){
       for(int x=0;x<seeds2.xsize();x++){
@@ -52,7 +54,7 @@ void twomasks()
     }
   }
   
-
+  
   counter.save();
   
 }
diff --git a/streamlines.cc b/streamlines.cc
index 8f3749e71da49f775f05d5c793971af9f011392a..59738389d915dc7bd1cf87634545d68dacc610a8 100644
--- a/streamlines.cc
+++ b/streamlines.cc
@@ -124,22 +124,25 @@ namespace TRACT{
 	int x_s =(int)round((float)xyz_seeds(1));
 	int y_s =(int)round((float)xyz_seeds(2));
 	int z_s =(int)round((float)xyz_seeds(3));
-	if(opts.rubbishfile.value()!=""){
-	  if(m_rubbish(x_s,y_s,z_s)>0) break;
-	}
 	  
+	//update every passed_flag
+	for( unsigned int wm=0;wm<m_waymasks.size();wm++ ){
+	  if( (*m_waymasks[wm])(x_s,y_s,z_s)>0 ) {
+	    m_passed_flags[wm]=true;
+	  }
+	}
 	m_path.push_back(xyz_seeds);
 	//	  m_path(it,1)=x_s; 
 	//	  m_path(it,2)=y_s;
 	//	  m_path(it,3)=z_s;
 	partlength++;
-	  
-	//update every passed_flag
-	for( unsigned int wm=0;wm<m_waymasks.size();wm++ ){
-	  if( (*m_waymasks[wm])(x_s,y_s,z_s)>0 ) 
-	    m_passed_flags[wm]=true;
+	
+
+	if(opts.rubbishfile.value()!=""){
+	  if(m_rubbish(x_s,y_s,z_s)>0) break;
 	}
 	  
+	
 	  
 	if(opts.skipmask.value() == ""){
 	  th_ph_f=vols.sample(m_part.x(),m_part.y(),m_part.z(),m_part.rx(),m_part.ry(),m_part.rz());
@@ -188,8 +191,8 @@ namespace TRACT{
     }   
     return accept_path;
   }
-
-
+  
+  
   void Counter::initialise(){
     if(opts.simpleout.value()||opts.matrix1out.value()){
       initialise_path_dist();
@@ -554,7 +557,7 @@ namespace TRACT{
       m_stline.reset();
       bool forwardflag=false,backwardflag=false;
       if(!onewayonly){
-	if(m_stline.streamline(x,y,z,m_seeddims,fibst)){
+	if(m_stline.streamline(x,y,z,m_seeddims,fibst)){ //returns whether to count the streamline or not
 	  forwardflag=true;
 	  m_counter.store_path();
 	  m_counter.count_streamline();