diff --git a/NonLinearSolver/modelReduction/DeepMaterialNetworks.cpp b/NonLinearSolver/modelReduction/DeepMaterialNetworks.cpp
index a9a5f35f4397ecce35dbd620b72591c4e49eb495..c9b2b94e06a46fa9ebbf8471a2af11548e2f5cfd 100644
--- a/NonLinearSolver/modelReduction/DeepMaterialNetworks.cpp
+++ b/NonLinearSolver/modelReduction/DeepMaterialNetworks.cpp
@@ -722,8 +722,7 @@ void BimaterialHomogenization::computeBimaterial(const fullMatrix<double>& C1, c
                         fullMatrix<double>* DCeffDnormal1,fullMatrix<double>* DCeffDnormal2, fullMatrix<double>* DCeffDnormal3) const
 {
   double tol = 1e-10;
-  double tolF = 1e-6;
-  if ((C1.norm() < tol*C2.norm()) || (f1 < tolF*f2))
+  if ((C1.norm() < tol*C2.norm()))
   {
     // C1 is void
     Ceff  = C2;
@@ -744,7 +743,7 @@ void BimaterialHomogenization::computeBimaterial(const fullMatrix<double>& C1, c
       fullMatrixOperation::allocateAndMakeZero(*DCeffDnormal3,Ceff.size1(),Ceff.size2());
     };
   }
-  else if ((C2.norm() < tol*C1.norm()) || (f2 < tolF*f1))
+  else if ((C2.norm() < tol*C1.norm()))
   {
     Ceff = C1;
     Ceff.scale(f1);
diff --git a/NonLinearSolver/modelReduction/Tree.cpp b/NonLinearSolver/modelReduction/Tree.cpp
index 185581bb43f57cfa230ca5739b0517fd8828f4ca..e123656bae15a5bfdfc577d41054c163c151a96d 100644
--- a/NonLinearSolver/modelReduction/Tree.cpp
+++ b/NonLinearSolver/modelReduction/Tree.cpp
@@ -2138,6 +2138,7 @@ void Tree::clear()
   _root = NULL;
 };
 
+#if 0
 void Tree::initialize(bool rand, bool normalizedWeight)
 {
   // random weight for leaves
@@ -2163,8 +2164,7 @@ void Tree::initialize(bool rand, bool normalizedWeight)
   for (int i=0; i< allLeaves.size(); i++)
   {
     TreeNode* n = allLeaves[i];
-    double randVal = getVal(minWeight,maxWeight);
-    n->weight = n->af->getReciprocalVal(randVal); 
+    n->weight = getVal(minWeight,maxWeight);
     toltalWeightLeaves += n->af->getVal(n->weight);
   }
   
@@ -2174,7 +2174,8 @@ void Tree::initialize(bool rand, bool normalizedWeight)
     if (normalizedWeight)
     {
       double vv = (n->af->getVal(n->weight))/toltalWeightLeaves;
-      n->weight = n->af->getReciprocalVal(vv);      
+      //n->weight = n->af->getReciprocalVal(vv);   
+      n->weight = vv;
     }
     // propagate data
     double w = n->weight;
@@ -2202,3 +2203,64 @@ void Tree::initialize(bool rand, bool normalizedWeight)
   };
 };
 
+#else
+void Tree::initialize(bool rand,bool normalizedWeight)
+{
+  // random weight for leaves
+  unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
+  std::default_random_engine generator(seed);
+  std::uniform_real_distribution<double> distribution(0., 1.); 
+  
+  auto getVal = [&](double min, double max)
+  {
+    double x = 0.5;
+    if (rand)
+    {
+      x= distribution(generator);
+    }
+    return (max-min)*x + min;
+  };
+  
+  double minWeight = 0.2;
+  double maxWeight = 0.8;
+  std::vector<TreeNode*> allLeaves;
+  getRefToAllLeaves(allLeaves);
+  double toltalWeightLeaves = 0.;
+  for (int i=0; i< allLeaves.size(); i++)
+  {
+    TreeNode* n = allLeaves[i];
+    n->weight = getVal(minWeight,maxWeight); 
+    toltalWeightLeaves += n->af->getVal(n->weight);
+  }
+  for (int i=0; i< allLeaves.size(); i++)
+  {
+    TreeNode* n = allLeaves[i];
+    n->weight *= (1./toltalWeightLeaves);
+    // propagate data
+    double w = n->weight;
+    TreeNode* pp = n->parent;
+    while (pp != NULL)
+    {
+      pp->weight += n->af->getVal(w);
+      pp = pp->parent;
+    };
+  };
+    
+  //printf("pi = %e\n",pi);
+  double minAlpha = 0.;
+  double maxAlpha = 1;
+  //
+  std::vector<TreeNode*> allNodes;
+  getRefToAllNodes(allNodes);
+  printf("num of nodes = %d\n",allNodes.size());
+  for (int i=0; i< allNodes.size(); i++)
+  {
+    TreeNode& node = *(allNodes[i]);
+    for (int j=0; j<node.direction.size(); j++)
+    {
+      node.direction[j] = getVal(minAlpha,maxAlpha);   
+    }
+  };
+};
+
+#endif //
\ No newline at end of file