unchanged:
--- ./src/help.c	2011-09-22 14:51:57.000000000 +1200
+++ /home/guindon/Desktop/phyml-20120412/src/help.c	2012-04-25 11:44:00.223996882 +1200
@@ -96,7 +96,7 @@ void Usage()
   PhyML_Printf("\n");
 
   
-  PhyML_Printf("%s\n\t-q (or --sequential)\n",BOLD);
+  PhyML_Printf("%s\n\t-q (or --sequential)%s\n",BOLD,FLAT);
   PhyML_Printf("%s\t\tChanges interleaved format (default) to sequential format.\n",FLAT);
   PhyML_Printf("\n");
 
unchanged:
--- ./src/lk.c	2012-04-05 14:47:37.000000000 +1200
+++ /home/guindon/Desktop/phyml-20120412/src/lk.c	2012-04-26 20:31:31.206512408 +1200
@@ -472,7 +472,7 @@ phydbl Lk_Core(t_edge *b, t_tree *tree)
   phydbl site_lk_cat, site_lk;
   int sum_scale_left, sum_scale_rght;
   int fact_sum_scale;
-  phydbl max_sum_scale;
+  phydbl max_sum_scale,min_sum_scale;
   phydbl sum;
   int ambiguity_check,state;
   int catg,ns,k,l,site;
@@ -481,11 +481,12 @@ phydbl Lk_Core(t_edge *b, t_tree *tree)
   phydbl multiplier;
   int exponent, piecewise_exponent;
   phydbl tmp;
-  phydbl logbig;
+  phydbl logbig,logsmall;
   phydbl inv_site_lk;
 
 
-  logbig = LOG((phydbl)BIG);
+  logbig   = LOG((phydbl)BIG);
+  logsmall = LOG((phydbl)SMALL);
 
   dim1 = tree->mod->n_catg * tree->mod->ns;
   dim2 = tree->mod->ns;
@@ -555,7 +556,7 @@ phydbl Lk_Core(t_edge *b, t_tree *tree)
                             b->Pij_rr[catg*dim3+k*dim2+l] *
                             b->p_lk_left[site*dim1+catg*dim2+l];
                         }
-
+		      
                       site_lk_cat +=
                         sum *
                         tree->mod->pi->v[k] *
@@ -578,7 +579,7 @@ phydbl Lk_Core(t_edge *b, t_tree *tree)
                         b->Pij_rr[catg*dim3+k*dim2+l] *
                         b->p_lk_left[site*dim1+catg*dim2+l];
                     }
-
+		  
                   site_lk_cat +=
                     sum *
                     tree->mod->pi->v[k] *
@@ -588,8 +589,9 @@ phydbl Lk_Core(t_edge *b, t_tree *tree)
 	}
       tree->site_lk_cat[catg] = site_lk_cat;
     }
-    
+
   max_sum_scale =  (phydbl)BIG;
+  min_sum_scale =  (phydbl)SMALL;
   For(catg,tree->mod->n_catg)
     {
       sum_scale_left_cat[catg] =
@@ -606,18 +608,30 @@ phydbl Lk_Core(t_edge *b, t_tree *tree)
 
       if(sum < .0)
 	{
-	  PhyML_Printf("\n. sum = %G",sum);
-	  PhyML_Printf("\n. Err in file %s at line %d\n\n",__FILE__,__LINE__);
+	  PhyML_Printf("\n== sum = %G",sum);
+	  PhyML_Printf("\n== Err in file %s at line %d\n\n",__FILE__,__LINE__);
 	  Warn_And_Exit("\n");
 	}
 
       tmp = sum + (logbig - LOG(tree->site_lk_cat[catg]))/(phydbl)LOG2;
       if(tmp < max_sum_scale) max_sum_scale = tmp; /* min of the maxs */
+
+      tmp = sum + (logsmall - LOG(tree->site_lk_cat[catg]))/(phydbl)LOG2;
+      if(tmp > min_sum_scale) min_sum_scale = tmp; /* max of the mins */
+    }
+
+  if(min_sum_scale > max_sum_scale)
+    {
+      /* PhyML_Printf("\n== Numerical precision issue alert."); */
+      /* PhyML_Printf("\n== min_sum_scale = %G max_sum_scale = %G",min_sum_scale,max_sum_scale); */
+      /* PhyML_Printf("\n== Err in file %s at line %d\n\n",__FILE__,__LINE__); */
+      /* Warn_And_Exit("\n"); */
+      min_sum_scale = max_sum_scale;
     }
 
-/*   fact_sum_scale = (int)((max_sum_scale + min_sum_scale) / 2); */
+  fact_sum_scale = (int)((max_sum_scale + min_sum_scale) / 2);
 
-  fact_sum_scale = (int)(max_sum_scale / 2);
+  /* fact_sum_scale = (int)(max_sum_scale / 2); */
 
   /* Apply scaling factors */
   For(catg,tree->mod->n_catg)
@@ -651,12 +665,13 @@ phydbl Lk_Core(t_edge *b, t_tree *tree)
 
       if(isinf(site_lk_cat))
 	{
-	  PhyML_Printf("\n+ site=%4d cat=%4d site_lk_cat=%G sum_scale=%d max=%G fact=%d expo=%d dbl=%G",
+	  PhyML_Printf("\n+ site=%4d cat=%4d site_lk_cat=%G sum_scale=%d max=%G min=%G fact=%d expo=%d dbl=%G",
 		       tree->curr_site,
 		       catg,
 		       tree->site_lk_cat[catg],
 		       sum_scale_left_cat[catg]+sum_scale_rght_cat[catg],
 		       max_sum_scale,
+		       min_sum_scale,
 		       fact_sum_scale,
 		       -(sum_scale_left_cat[catg]+sum_scale_rght_cat[catg])+fact_sum_scale,
 		       (double)tree->site_lk_cat[catg] * pow(2.,-(sum_scale_left_cat[catg]+sum_scale_rght_cat[catg])+fact_sum_scale));
@@ -678,13 +693,11 @@ phydbl Lk_Core(t_edge *b, t_tree *tree)
 			   fact_sum_scale,
 			   -(sum_scale_left_cat[catg]+sum_scale_rght_cat[catg])+fact_sum_scale,
 			   (double)tree->site_lk_cat[catg] * pow(2.,-(sum_scale_left_cat[catg]+sum_scale_rght_cat[catg])+fact_sum_scale));
-
+	      
 	      Exit("\n");
 	    }
-
 	  site_lk_cat = .0;
 	}
-
       tree->site_lk_cat[catg] = site_lk_cat;
     }
 
@@ -694,6 +707,24 @@ phydbl Lk_Core(t_edge *b, t_tree *tree)
       site_lk += tree->site_lk_cat[catg] * tree->mod->gamma_r_proba->v[catg];
     }
 
+  if(isinf(site_lk))
+    {
+      PhyML_Printf("\n= Site = %d",site);
+      PhyML_Printf("\n= invar = %d",tree->data->invar[site]);
+      PhyML_Printf("\n= scale_left = %d scale_rght = %d",sum_scale_left,sum_scale_rght);
+      PhyML_Printf("\n= lk = %G log(lk) = %f < %G",site_lk,log_site_lk,-BIG);
+      PhyML_Printf("\n= fact_sum_scale = %d",fact_sum_scale);
+      For(catg,tree->mod->n_catg) PhyML_Printf("\n. rr=%f p=%f lk=%G expo=%d",
+					       tree->mod->gamma_rr->v[catg],
+					       tree->mod->gamma_r_proba->v[catg],
+					       tree->site_lk_cat[catg],
+					       -(sum_scale_left_cat[catg]+sum_scale_rght_cat[catg])+fact_sum_scale);
+      PhyML_Printf("\n= pinv = %G",tree->mod->pinvar->v);
+      PhyML_Printf("\n= bl mult = %G",tree->mod->br_len_multiplier->v);
+      PhyML_Printf("\n. Err in file %s at line %d",__FILE__,__LINE__);
+      Warn_And_Exit("\n");
+    }
+
 
   inv_site_lk = 0.;
   
@@ -741,19 +772,22 @@ phydbl Lk_Core(t_edge *b, t_tree *tree)
 
   log_site_lk = LOG(site_lk) - (phydbl)LOG2 * fact_sum_scale;
 
-
   For(catg,tree->mod->n_catg) tree->log_site_lk_cat[catg][site] = LOG(tree->site_lk_cat[catg]) - (phydbl)LOG2 * fact_sum_scale;
   
   if(isinf(log_site_lk) || isnan(log_site_lk))
     {
-      PhyML_Printf("\n. Site = %d",site);
-      PhyML_Printf("\n. invar = %d",tree->data->invar[site]);
-      PhyML_Printf("\n. scale_left = %d scale_rght = %d",sum_scale_left,sum_scale_rght);
-      PhyML_Printf("\n. inv_site_lk = %f",inv_site_lk);
-      PhyML_Printf("\n. Lk = %G LOG(Lk) = %f < %G",site_lk,log_site_lk,-BIG);
-      For(catg,tree->mod->n_catg) PhyML_Printf("\n. rr=%f p=%f",tree->mod->gamma_rr->v[catg],tree->mod->gamma_r_proba->v[catg]);
-      PhyML_Printf("\n. pinv = %G",tree->mod->pinvar->v);
-      PhyML_Printf("\n. bl mult = %G",tree->mod->br_len_multiplier->v);
+      PhyML_Printf("\n= Site = %d",site);
+      PhyML_Printf("\n= invar = %d",tree->data->invar[site]);
+      PhyML_Printf("\n= scale_left = %d scale_rght = %d",sum_scale_left,sum_scale_rght);
+      PhyML_Printf("\n= inv_site_lk = %f",inv_site_lk);
+      PhyML_Printf("\n= lk = %G log(lk) = %f < %G",site_lk,log_site_lk,-BIG);
+      For(catg,tree->mod->n_catg) PhyML_Printf("\n. rr=%f p=%f lk=%G",
+					       tree->mod->gamma_rr->v[catg],
+					       tree->mod->gamma_r_proba->v[catg],
+					       tree->site_lk_cat[catg]);
+      PhyML_Printf("\n= pinv = %G",tree->mod->pinvar->v);
+      PhyML_Printf("\n= bl mult = %G",tree->mod->br_len_multiplier->v);
+      PhyML_Printf("\n= fact_sum_scale = %d",fact_sum_scale);
 
       /* int i; */
       /* For(i,2*tree->n_otu-3) */
unchanged:
--- ./src/utilities.h	2012-04-11 11:39:02.000000000 +1200
+++ /home/guindon/Desktop/phyml-20120412/src/utilities.h	2012-04-26 17:31:24.346514047 +1200
@@ -272,6 +272,8 @@ typedef	double phydbl;
 /* #define P_LK_LIM_SUP 2.037035976e+90 /\* R: format(2^(+300),digits=10) *\/ */
 #define  P_LK_LIM_INF   3.054936e-151 /* 2^-500 */
 #define  P_LK_LIM_SUP   3.273391e+150 /* 2^500 */
+/* #define  P_LK_LIM_INF   1.499697e-241 /\* 2^-800 *\/ */
+/* #define  P_LK_LIM_SUP   6.668014e+240 /\* 2^800 *\/ */
 
 
 /*!********************************************************/
unchanged:
--- utilities.new.c	2012-07-11 22:07:12.667679119 +1200
+++ utilities.c	2012-11-02 14:09:47.503653796 +1300
@@ -5854,7 +5854,8 @@
 
 /*   For(i,2*tree->n_otu-3) fprintf(fp_out,"\n. * Edge %3d: %f",i,tree->t_edges[i]->l); */
   
-  if((!n_data_set) || (!num_tree))
+  /* if((!n_data_set) || (!num_tree)) */
+  if((!n_data_set) && (!num_tree))
     {
       rewind(fp_out);
       Print_Banner_Small(fp_out);
@@ -8049,11 +8050,23 @@
   t_node **bip1, **bip2;
   int bip_size1, bip_size2, bip_size;
   int different,identical;
+  int n_edges;
 
   /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
   /* WARNING: call Match_Tip_Numbers and Get_Bip before using this function. */
   /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
   
+  if(on_existing_edges_only == YES)
+    {
+      n_edges = 0;
+      For(i,2*tree1->n_otu-3) 
+	if(tree1->t_edges[i]->does_exist && tree2->t_edges[i]->does_exist) n_edges++;
+      n_edges -= tree1->n_otu;
+    }
+  else
+    {
+      n_edges = tree1->n_otu-3;
+    }
   
   identical = 0;
   different = 0;
@@ -8070,7 +8083,7 @@
 	      bip_size2 = MIN(b2->left->bip_size[b2->l_r],b2->rght->bip_size[b2->r_l]);
 
 	      if(bip_size2 > 1 && ((on_existing_edges_only == YES && b2->does_exist) || (on_existing_edges_only == NO)))
-		{
+		{		  
 		  if(bip_size1 == bip_size2)
 		    {
 		      bip_size = bip_size1;
@@ -8139,17 +8152,21 @@
 			  b1->bip_score++;
 			  b2->bip_score++;
 			  identical++;			  
-			  break;
+			  goto out;
+			}
+		      else 
+			{
+			  different++; // Bipartitions have identical sizes but distinct elements
 			}
-		      else different++; // Bipartitions has identical size but distinct elements
 		    }
 		  else different++; // Biparition have different sizes
 		}
 	    }
 	}
+    out: ;
     }
-  
-  return different;
+  return n_edges - identical;
+  /* return different; */
 }
 
 //////////////////////////////////////////////////////////////
@@ -12465,6 +12482,9 @@
       Warn_And_Exit("");
     }
 
+
+  if(node_list_size == 1) return node_list[0];
+
   list = (t_node ***)mCalloc(node_list_size,sizeof(t_node **));
   For(i,node_list_size) list[i] = (t_node **)mCalloc(2*tree->n_otu-1,sizeof(t_node *));
   size = (int *)mCalloc(node_list_size,sizeof(int));
unchanged:
--- mcmc.c	2012-03-20 14:10:49.000000000 +1300
+++ mcmc.new.c	2012-07-17 23:56:36.814757573 +1200
@@ -1977,7 +1977,7 @@
       if(tree->mod->n_catg > 1)
 	{
 	  if(tree->mod->free_mixt_rates == NO)
-	    PhyML_Fprintf(fp,"%G\t",tree->mod->alpha);
+	    PhyML_Fprintf(fp,"%G\t",tree->mod->alpha->v);
 	  else
 	    {
 	      For(i,tree->mod->n_catg) PhyML_Fprintf(fp,"%G\t",tree->mod->gamma_r_proba->v[i]);
only in patch2:
unchanged:
--- ./utilities.c.ori	2012-11-09 09:54:54.115351796 +1300
+++ ./utilities.c	2012-11-09 09:55:03.398354251 +1300
@@ -12242,6 +12242,9 @@
 
   aLRT(tree);
   
+  Br_Len_Involving_Invar(tree);
+  Rescale_Br_Len_Multiplier_Tree(tree);
+  
   Free(s_tree);
   s_tree = Write_Tree(tree,NO);
 
