diff --git a/modules/gfx/src/entity.cc b/modules/gfx/src/entity.cc
index dff4bfa1fb8465036438a59ebdf8f72dc2a3277b..c48a544cfdf3c046246a356b61fc101ad8032bde 100644
--- a/modules/gfx/src/entity.cc
+++ b/modules/gfx/src/entity.cc
@@ -968,7 +968,7 @@ void Entity::ColorBy(const String& prop,
                      const Color& c1, const Color& c2,
                      mol::Prop::Level level)
 {
-  std::pair<float,float> minmax = this->GetView().GetMinMax(prop);
+  std::pair<float,float> minmax = this->GetView().GetMinMax(prop, level);
   this->ColorBy(prop,c1,c2,minmax.first, minmax.second,level);
 }
 
diff --git a/modules/mol/base/tests/test_entity.cc b/modules/mol/base/tests/test_entity.cc
index 1b8b195bd22307710b72c77f377475e2aa5d3ffc..9539158d27ced2fa8a1cbd066fef19ae0e1771e2 100644
--- a/modules/mol/base/tests/test_entity.cc
+++ b/modules/mol/base/tests/test_entity.cc
@@ -23,6 +23,7 @@
 #include <ost/geom/vec_mat_predicates.hh>
 #include <ost/mol/chem_class.hh>
 #include <ost/mol/mol.hh>
+#include <ost/mol/property_id.hh>
 #include <cmath>
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
@@ -413,4 +414,19 @@ BOOST_AUTO_TEST_CASE(rename_atom)
    BOOST_CHECK_EQUAL(atom.GetName(), "B");
 }
 
+BOOST_AUTO_TEST_CASE(minmax)
+{
+  EntityHandle eh=make_test_entity();
+  EntityView ev = eh.CreateFullView();
+  mol::AtomViewList avl = ev.GetAtomList();
+  mol::AtomViewList::iterator i;
+  int n=0.0;
+  for (i=avl.begin(); i!=avl.end(); ++i, ++n) {
+    i->SetFloatProp("test", n);
+  }
+  std::pair<float,float> minmax = ev.GetMinMax("test", Prop::ATOM);
+  BOOST_CHECK_EQUAL(minmax.first, 0.0);
+  BOOST_CHECK_EQUAL(minmax.second, 7.0);
+}
+
 BOOST_AUTO_TEST_SUITE_END();