Index: cmake/FindILOG.cmake
===================================================================
--- cmake/FindILOG.cmake	(revision 1331)
+++ cmake/FindILOG.cmake	(revision 1427)
@@ -97,5 +97,5 @@
   IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
     # SET(CPLEX_LIBRARIES "${CPLEX_LIBRARIES};m;pthread")
-    SET(ILOG_LIBRARIES ${ILOG_LIBRARIES} "m" "pthread")
+    SET(ILOG_LIBRARIES ${ILOG_LIBRARIES} "m" "pthread" "dl")
   ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
 ENDIF(ILOG_FOUND)
Index: lemon/clp.cc
===================================================================
--- lemon/clp.cc	(revision 1336)
+++ lemon/clp.cc	(revision 1428)
@@ -228,12 +228,12 @@
 
   ClpLp::Value ClpLp::_getCoeff(int ix, int jx) const {
-    CoinBigIndex begin = _prob->clpMatrix()->getVectorStarts()[ix];
-    CoinBigIndex end = begin + _prob->clpMatrix()->getVectorLengths()[ix];
+    CoinBigIndex begin = _prob->clpMatrix()->getVectorStarts()[jx];
+    CoinBigIndex end = begin + _prob->clpMatrix()->getVectorLengths()[jx];
 
     const int* indices = _prob->clpMatrix()->getIndices();
     const double* elements = _prob->clpMatrix()->getElements();
 
-    const int* it = std::lower_bound(indices + begin, indices + end, jx);
-    if (it != indices + end && *it == jx) {
+    const int* it = std::lower_bound(indices + begin, indices + end, ix);
+    if (it != indices + end && *it == ix) {
       return elements[it - indices];
     } else {
@@ -462,3 +462,13 @@
   }
 
+   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 1336)
+++ lemon/clp.h	(revision 1428)
@@ -140,4 +140,6 @@
     virtual void _messageLevel(MessageLevel);
 
+    void _write(std::string file, std::string format) const;
+
   public:
 
Index: lemon/cplex.cc
===================================================================
--- lemon/cplex.cc	(revision 1349)
+++ lemon/cplex.cc	(revision 1427)
@@ -159,5 +159,5 @@
       const char s = 'R';
       double len = ub - lb;
-      CPXaddrows(cplexEnv(), _prob, 0, 1, values.size(), &ub, &s,
+      CPXaddrows(cplexEnv(), _prob, 0, 1, values.size(), &lb, &s,
                  &rmatbeg, &indices.front(), &values.front(), 0, 0);
       CPXchgrngval(cplexEnv(), _prob, 1, &i, &len);
Index: test/lp_test.cc
===================================================================
--- test/lp_test.cc	(revision 1337)
+++ test/lp_test.cc	(revision 1427)
@@ -340,4 +340,5 @@
   check(lp.sense() == lp.MAX,"This is a maximization!");
   check(lp.coeff(upright,x1)==1,"The coefficient in question is 1!");
+  check(lp.coeff(upright,x2)==2,"The coefficient in question is 1!");
   check(lp.colLowerBound(x1)==0,
         "The lower bound for variable x1 should be 0.");
@@ -425,4 +426,32 @@
 }
 
+template<class LP>
+void rangeConstraintTest()
+{
+  LP lp;
+  // Add two columns (variables) to the problem
+  typename LP::Col x1 = lp.addCol();
+  typename LP::Col x2 = lp.addCol();
+  // Add rows (constraints) to the problem
+  lp.addRow(x1 - 5 <= x2);
+    lp.addRow(0 <= 2 * x1 + x2 <= 25);
+  
+  // Set lower and upper bounds for the columns (variables)
+  lp.colLowerBound(x1, 0);
+  lp.colUpperBound(x2, 10);
+  
+  // Specify the objective function
+  lp.max();
+  lp.obj(5 * x1 + 3 * x2);
+  
+  // Solve the problem using the underlying LP solver
+  lp.solve();
+  // Print the results
+  check(lp.primalType() == LP::OPTIMAL, "Optimal solution is not found");
+  check(lp.primal() <= 67.501 && lp.primal() >= 67.499, "Wrong objective value");
+  check(lp.primal(x1) <= 7.501 && lp.primal(x1) >= 7.499, "Wrong value for x1");
+  check(lp.primal(x2) <= 10.001 && lp.primal(x2) >= 9.999, "Wrong value for x2");
+}
+
 int main()
 {
@@ -445,4 +474,5 @@
     aTest(lp_glpk2);
     cloneTest<GlpkLp>();
+    rangeConstraintTest<GlpkLp>();
   }
 #endif
@@ -454,4 +484,5 @@
     aTest(lp_cplex2);
     cloneTest<CplexLp>();
+    rangeConstraintTest<CplexLp>();
   } catch (CplexEnv::LicenseError& error) {
     check(false, error.what());
@@ -465,4 +496,5 @@
     aTest(lp_soplex2);
     cloneTest<SoplexLp>();
+    rangeConstraintTest<Soplex>();
   }
 #endif
@@ -474,4 +506,5 @@
     aTest(lp_clp2);
     cloneTest<ClpLp>();
+    rangeConstraintTest<ClpLp>();
   }
 #endif
Index: test/mip_test.cc
===================================================================
--- test/mip_test.cc	(revision 1300)
+++ test/mip_test.cc	(revision 1427)
@@ -62,5 +62,5 @@
 }
 
-void aTest(MipSolver& mip)
+void aTest(MipSolver& mip, bool solve_empty=true)
 {
   //The following example is very simple
@@ -81,5 +81,6 @@
 
   //Unconstrained optimization
-  mip.solve();
+  if(solve_empty)
+    mip.solve();
   //Check it out!
 
@@ -136,5 +137,9 @@
   {
     Mip mip1;
+#if LEMON_DEFAULT_MIP==LEMON_CBC_
+    aTest(mip1, false);
+#else
     aTest(mip1);
+#endif
     cloneTest<Mip>();
   }
@@ -162,5 +167,5 @@
   {
     CbcMip mip1;
-    aTest(mip1);
+    aTest(mip1, false);
     cloneTest<CbcMip>();
   }
