Index: lemon/clp.cc
===================================================================
--- lemon/clp.cc	(revision 1428)
+++ lemon/clp.cc	(revision 1336)
@@ -228,12 +228,12 @@
 
   ClpLp::Value ClpLp::_getCoeff(int ix, int jx) const {
-    CoinBigIndex begin = _prob->clpMatrix()->getVectorStarts()[jx];
-    CoinBigIndex end = begin + _prob->clpMatrix()->getVectorLengths()[jx];
+    CoinBigIndex begin = _prob->clpMatrix()->getVectorStarts()[ix];
+    CoinBigIndex end = begin + _prob->clpMatrix()->getVectorLengths()[ix];
 
     const int* indices = _prob->clpMatrix()->getIndices();
     const double* elements = _prob->clpMatrix()->getElements();
 
-    const int* it = std::lower_bound(indices + begin, indices + end, ix);
-    if (it != indices + end && *it == ix) {
+    const int* it = std::lower_bound(indices + begin, indices + end, jx);
+    if (it != indices + end && *it == jx) {
       return elements[it - indices];
     } else {
@@ -462,13 +462,3 @@
   }
 
-   void ClpLp::_write(std::string file, std::string format) const
-  {
-    if(format == "LP")
-      _prob->writeLp(file.c_str(), "", 1e-5, 10, 5,
-                     sense()==ClpLp::MIN?1:-1,
-                     true
-                     );
-    else throw UnsupportedFormatError(format);
-  }
- 
 } //END OF NAMESPACE LEMON
Index: lemon/clp.h
===================================================================
--- lemon/clp.h	(revision 1428)
+++ lemon/clp.h	(revision 1336)
@@ -140,6 +140,4 @@
     virtual void _messageLevel(MessageLevel);
 
-    void _write(std::string file, std::string format) const;
-
   public:
 
Index: lemon/cplex.cc
===================================================================
--- lemon/cplex.cc	(revision 1427)
+++ lemon/cplex.cc	(revision 1349)
@@ -159,5 +159,5 @@
       const char s = 'R';
       double len = ub - lb;
-      CPXaddrows(cplexEnv(), _prob, 0, 1, values.size(), &lb, &s,
+      CPXaddrows(cplexEnv(), _prob, 0, 1, values.size(), &ub, &s,
                  &rmatbeg, &indices.front(), &values.front(), 0, 0);
       CPXchgrngval(cplexEnv(), _prob, 1, &i, &len);
Index: lemon/matching.h
===================================================================
--- lemon/matching.h	(revision 1423)
+++ lemon/matching.h	(revision 1430)
@@ -744,6 +744,6 @@
       Value value;
 
-      BlossomVariable(int _begin, int _end, Value _value)
-        : begin(_begin), end(_end), value(_value) {}
+      BlossomVariable(int _begin, Value _value)
+          : begin(_begin), end(-1), value(_value) {}
 
     };
@@ -1522,38 +1522,58 @@
     }
 
+    struct ExtractBlossomItem {
+      int blossom;
+      Node base;
+      Arc matching;
+      int close_index;
+      ExtractBlossomItem(int _blossom, Node _base,
+                         Arc _matching, int _close_index)
+          : blossom(_blossom), base(_base), matching(_matching),
+            close_index(_close_index) {}
+    };
+
     void extractBlossom(int blossom, const Node& base, const Arc& matching) {
-      if (_blossom_set->trivial(blossom)) {
-        int bi = (*_node_index)[base];
-        Value pot = (*_node_data)[bi].pot;
-
-        (*_matching)[base] = matching;
-        _blossom_node_list.push_back(base);
-        (*_node_potential)[base] = pot;
-      } else {
-
-        Value pot = (*_blossom_data)[blossom].pot;
-        int bn = _blossom_node_list.size();
-
-        std::vector<int> subblossoms;
-        _blossom_set->split(blossom, std::back_inserter(subblossoms));
-        int b = _blossom_set->find(base);
-        int ib = -1;
-        for (int i = 0; i < int(subblossoms.size()); ++i) {
-          if (subblossoms[i] == b) { ib = i; break; }
-        }
-
-        for (int i = 1; i < int(subblossoms.size()); i += 2) {
-          int sb = subblossoms[(ib + i) % subblossoms.size()];
-          int tb = subblossoms[(ib + i + 1) % subblossoms.size()];
-
-          Arc m = (*_blossom_data)[tb].next;
-          extractBlossom(sb, _graph.target(m), _graph.oppositeArc(m));
-          extractBlossom(tb, _graph.source(m), m);
-        }
-        extractBlossom(subblossoms[ib], base, matching);
-
-        int en = _blossom_node_list.size();
-
-        _blossom_potential.push_back(BlossomVariable(bn, en, pot));
+      std::vector<ExtractBlossomItem> stack;
+      std::vector<int> close_stack;
+      stack.push_back(ExtractBlossomItem(blossom, base, matching, 0));
+      while (!stack.empty()) {
+        if (_blossom_set->trivial(stack.back().blossom)) {
+          int bi = (*_node_index)[stack.back().base];
+          Value pot = (*_node_data)[bi].pot;
+
+          (*_matching)[stack.back().base] = stack.back().matching;
+          (*_node_potential)[stack.back().base] = pot;
+          _blossom_node_list.push_back(stack.back().base);
+          while (int(close_stack.size()) > stack.back().close_index) {
+            _blossom_potential[close_stack.back()].end = _blossom_node_list.size();
+            close_stack.pop_back();
+          }
+          stack.pop_back();
+        } else {
+          Value pot = (*_blossom_data)[stack.back().blossom].pot;
+          int bn = _blossom_node_list.size();
+          close_stack.push_back(_blossom_potential.size());
+          _blossom_potential.push_back(BlossomVariable(bn, pot));
+
+          std::vector<int> subblossoms;
+          _blossom_set->split(stack.back().blossom, std::back_inserter(subblossoms));
+          int b = _blossom_set->find(stack.back().base);
+          int ib = -1;
+          for (int i = 0; i < int(subblossoms.size()); ++i) {
+            if (subblossoms[i] == b) { ib = i; break; }
+          }
+
+          stack.back().blossom = subblossoms[ib];
+          for (int i = 1; i < int(subblossoms.size()); i += 2) {
+            int sb = subblossoms[(ib + i) % subblossoms.size()];
+            int tb = subblossoms[(ib + i + 1) % subblossoms.size()];
+
+            Arc m = (*_blossom_data)[tb].next;
+            stack.push_back(ExtractBlossomItem(
+                sb, _graph.target(m), _graph.oppositeArc(m), close_stack.size()));
+            stack.push_back(ExtractBlossomItem(
+                tb, _graph.source(m), m, close_stack.size()));
+          }
+        }
       }
     }
@@ -2217,6 +2237,6 @@
       Value value;
 
-      BlossomVariable(int _begin, int _end, Value _value)
-        : begin(_begin), end(_end), value(_value) {}
+      BlossomVariable(int _begin, Value _value)
+        : begin(_begin), value(_value) {}
 
     };
@@ -2950,38 +2970,58 @@
     }
 
+    struct ExtractBlossomItem {
+      int blossom;
+      Node base;
+      Arc matching;
+      int close_index;
+      ExtractBlossomItem(int _blossom, Node _base,
+                         Arc _matching, int _close_index)
+          : blossom(_blossom), base(_base), matching(_matching),
+            close_index(_close_index) {}
+    };
+
     void extractBlossom(int blossom, const Node& base, const Arc& matching) {
-      if (_blossom_set->trivial(blossom)) {
-        int bi = (*_node_index)[base];
-        Value pot = (*_node_data)[bi].pot;
-
-        (*_matching)[base] = matching;
-        _blossom_node_list.push_back(base);
-        (*_node_potential)[base] = pot;
-      } else {
-
-        Value pot = (*_blossom_data)[blossom].pot;
-        int bn = _blossom_node_list.size();
-
-        std::vector<int> subblossoms;
-        _blossom_set->split(blossom, std::back_inserter(subblossoms));
-        int b = _blossom_set->find(base);
-        int ib = -1;
-        for (int i = 0; i < int(subblossoms.size()); ++i) {
-          if (subblossoms[i] == b) { ib = i; break; }
-        }
-
-        for (int i = 1; i < int(subblossoms.size()); i += 2) {
-          int sb = subblossoms[(ib + i) % subblossoms.size()];
-          int tb = subblossoms[(ib + i + 1) % subblossoms.size()];
-
-          Arc m = (*_blossom_data)[tb].next;
-          extractBlossom(sb, _graph.target(m), _graph.oppositeArc(m));
-          extractBlossom(tb, _graph.source(m), m);
-        }
-        extractBlossom(subblossoms[ib], base, matching);
-
-        int en = _blossom_node_list.size();
-
-        _blossom_potential.push_back(BlossomVariable(bn, en, pot));
+      std::vector<ExtractBlossomItem> stack;
+      std::vector<int> close_stack;
+      stack.push_back(ExtractBlossomItem(blossom, base, matching, 0));
+      while (!stack.empty()) {
+        if (_blossom_set->trivial(stack.back().blossom)) {
+          int bi = (*_node_index)[stack.back().base];
+          Value pot = (*_node_data)[bi].pot;
+
+          (*_matching)[stack.back().base] = stack.back().matching;
+          (*_node_potential)[stack.back().base] = pot;
+          _blossom_node_list.push_back(stack.back().base);
+          while (int(close_stack.size()) > stack.back().close_index) {
+            _blossom_potential[close_stack.back()].end = _blossom_node_list.size();
+            close_stack.pop_back();
+          }
+          stack.pop_back();
+        } else {
+          Value pot = (*_blossom_data)[stack.back().blossom].pot;
+          int bn = _blossom_node_list.size();
+          close_stack.push_back(_blossom_potential.size());
+          _blossom_potential.push_back(BlossomVariable(bn, pot));
+
+          std::vector<int> subblossoms;
+          _blossom_set->split(stack.back().blossom, std::back_inserter(subblossoms));
+          int b = _blossom_set->find(stack.back().base);
+          int ib = -1;
+          for (int i = 0; i < int(subblossoms.size()); ++i) {
+            if (subblossoms[i] == b) { ib = i; break; }
+          }
+
+          stack.back().blossom = subblossoms[ib];
+          for (int i = 1; i < int(subblossoms.size()); i += 2) {
+            int sb = subblossoms[(ib + i) % subblossoms.size()];
+            int tb = subblossoms[(ib + i + 1) % subblossoms.size()];
+
+            Arc m = (*_blossom_data)[tb].next;
+            stack.push_back(ExtractBlossomItem(
+                sb, _graph.target(m), _graph.oppositeArc(m), close_stack.size()));
+            stack.push_back(ExtractBlossomItem(
+                tb, _graph.source(m), m, close_stack.size()));
+          }
+        }
       }
     }
