diff --git a/modules/base/src/invalid_handle.hh b/modules/base/src/invalid_handle.hh
index 9f6861dd9b3d8169257140b019dc0212e7cf6367..fdb56203edf1b126aad19d06be3e0b070c2a29bd 100644
--- a/modules/base/src/invalid_handle.hh
+++ b/modules/base/src/invalid_handle.hh
@@ -37,7 +37,7 @@ public:
 template <typename H>
 inline void CheckHandleValidity(const H& handle)
 {
-  if (!handle.Impl())
+  if (!handle.IsValid())
     throw InvalidHandle();
 }
 
diff --git a/modules/img/base/tests/test_image.cc b/modules/img/base/tests/test_image.cc
index dde2a034f900d1f93269f02bdf462324e2867894..2342cb11e5b0f88b408ba2e6fd437ab4f870fa79 100644
--- a/modules/img/base/tests/test_image.cc
+++ b/modules/img/base/tests/test_image.cc
@@ -25,7 +25,7 @@
 #include <iostream>
 
 #include "test_image.hh"
-
+#include <ost/invalid_handle.hh>
 #include <ost/img/image.hh>
 #include <ost/img/data_observer.hh>
 #include <ost/img/observable.hh>
@@ -612,6 +612,13 @@ void test_PointToCoord() {
   BOOST_CHECK(spatial.CoordToIndex(Vec3(11.0,11.0,11.0)) == Vec3(3.0,3.0,3.0));
 }
 
+void test_ThrowInvalidImageHandle() {
+  ImageHandle image;
+  BOOST_CHECK_THROW(ost::CheckHandleValidity(image), ost::InvalidHandle);
+  image=CreateImage(Size(1,1));
+  BOOST_CHECK_NO_THROW(ost::CheckHandleValidity(image));
+}
+
 } // ns
 
 test_suite* CreateImageTest()
@@ -633,6 +640,7 @@ test_suite* CreateImageTest()
   ts->add(BOOST_TEST_CASE(&test_Copy));
   ts->add(BOOST_TEST_CASE(&test_Extract));
   ts->add(BOOST_TEST_CASE(&test_Paste));
+  ts->add(BOOST_TEST_CASE(&test_ThrowInvalidImageHandle));
   ts->add(BOOST_TEST_CASE(&test_Mult));
   ts->add(BOOST_TEST_CASE(&test_AddSub));
   ts->add(BOOST_TEST_CASE(&test_Interpolation));
diff --git a/modules/mol/base/pymod/export_atom.cc b/modules/mol/base/pymod/export_atom.cc
index ec7b4fbc5feca02132c7f7bd300fc8b4c59e726b..67fc5a16348faba02eafaac26b272138e14da5ae 100644
--- a/modules/mol/base/pymod/export_atom.cc
+++ b/modules/mol/base/pymod/export_atom.cc
@@ -74,6 +74,8 @@ void export_Atom()
     .add_property("is_hetatom", &AtomBase::IsHetAtom, &AtomBase::SetHetAtom)
     .add_property("charge", &AtomBase::GetCharge, &AtomBase::SetCharge)
     .add_property("mass", &AtomBase::GetMass, &AtomBase::SetMass)
+    .add_property("valid", &AtomBase::IsValid)
+    .def("IsValid", &AtomBase::IsValid)
   ;
   generic_prop_def<AtomBase>(atom_base);
 
@@ -82,8 +84,6 @@ void export_Atom()
     .add_property("residue",&AtomHandle::GetResidue)
     .def("GetBondList", &AtomHandle::GetBondList)
     .def("GetBondCount", &AtomHandle::GetBondCount)
-    .add_property("valid", &AtomHandle::IsValid)
-    .def("IsValid", &AtomHandle::IsValid)
     .def("GetEntity", &AtomHandle::GetEntity)
     .def("GetHandle", &AtomHandle::GetHandle)
     .add_property("handle", &AtomHandle::GetHandle)
diff --git a/modules/mol/base/pymod/export_chain.cc b/modules/mol/base/pymod/export_chain.cc
index 391fc4df8123fbed4a5adca79231ce6ba7552fc6..b21d5eb97a0a077fb590e8b1c121676042ff7566 100644
--- a/modules/mol/base/pymod/export_chain.cc
+++ b/modules/mol/base/pymod/export_chain.cc
@@ -48,6 +48,8 @@ void export_Chain()
     .def("GetName", &ChainBase::GetName)
     .add_property("name", &ChainBase::GetName)
     .def(self_ns::str(self))
+    .add_property("valid", &ChainBase::IsValid)
+    .def("IsValid", &ChainBase::IsValid)
   ;
   generic_prop_def<ChainBase>(chain_base);
   class_<ChainHandle, bases<ChainBase> >("ChainHandle", init<>())
@@ -80,7 +82,6 @@ void export_Chain()
     .def("InSequence", &ChainHandle::InSequence)
     .def("Select", select_string, arg("flags")=0)
     .def("Select", select_query, arg("flags")=0)
-    .def("IsValid", &ChainHandle::IsValid)
     .def("GetMass", &ChainHandle::GetMass)
     .def("GetCenterOfMass", &ChainHandle::GetCenterOfMass)
     .def("GetCenterOfAtoms", &ChainHandle::GetCenterOfAtoms)
@@ -90,7 +91,6 @@ void export_Chain()
     .add_property("center_of_mass", &ChainHandle::GetCenterOfMass)
     .add_property("center_of_atoms", &ChainHandle::GetCenterOfAtoms)  
     .add_property("in_sequence", &ChainHandle::InSequence)  
-    .add_property("valid", &ChainHandle::IsValid)    
     .def("GetBounds", &ChainHandle::GetBounds)
     .add_property("bounds", &ChainHandle::GetBounds)
     .def("GetGeometricStart", geom_start<ChainHandle>)
diff --git a/modules/mol/base/pymod/export_entity.cc b/modules/mol/base/pymod/export_entity.cc
index 4f80a09494a0e8527087cf6f54c0ebdfe62cdc40..3f3858ed0511b5e77c54c2293622e602ce593035 100644
--- a/modules/mol/base/pymod/export_entity.cc
+++ b/modules/mol/base/pymod/export_entity.cc
@@ -75,6 +75,8 @@ void export_Entity()
     .def("GetName", &EntityBase::GetName,
         return_value_policy<copy_const_reference>())
     .def("SetName", &EntityBase::SetName)
+    .def("IsValid", &EntityBase::IsValid)
+    .add_property("valid", &EntityBase::IsValid)
   ;
   generic_prop_def<EntityBase>(ent_base);
   
@@ -92,7 +94,7 @@ void export_Entity()
     .def("GetCenterOfAtoms", &EntityHandle::GetCenterOfAtoms)
     .def("GetGeometricCenter", geom_center<EntityHandle>)
     .add_property("geometric_center", geom_center<EntityHandle>)
-    .def("IsValid", &EntityHandle::IsValid)
+
     .add_property("geometric_end", geom_end<EntityHandle>)
     .add_property("geometric_start", geom_start<EntityHandle>)
     .def("GetGeometricStart", geom_start<EntityHandle>)
@@ -122,7 +124,6 @@ void export_Entity()
     .add_property("atoms", &EntityHandle::GetAtomList)
     .add_property("chains", &EntityHandle::GetChainList)
     .add_property("bonds", &EntityHandle::GetBondList)
-    .add_property("valid", &EntityHandle::IsValid)
     .def("GetBounds", &EntityHandle::GetBounds)
     .add_property("bounds", &EntityHandle::GetBounds)
     .def("GetTransformationMatrix", &EntityHandle::GetTransformationMatrix,
diff --git a/modules/mol/base/pymod/export_residue.cc b/modules/mol/base/pymod/export_residue.cc
index 715404555f075791f484f7d5c326f798278cbcd5..4679840eec1ffb033ffe20294abf19335a7cb986 100644
--- a/modules/mol/base/pymod/export_residue.cc
+++ b/modules/mol/base/pymod/export_residue.cc
@@ -134,6 +134,8 @@ void export_Residue()
                    make_function(&ResidueBase::GetName,
                                  return_value_policy<copy_const_reference>()))
     .add_property("qualified_name", &ResidueBase::GetQualifiedName)
+    .def("IsValid", &ResidueBase::IsValid)
+    .add_property("valid", &ResidueBase::IsValid) 
   ;
   generic_prop_def<ResidueBase>(residue_base);
 
@@ -159,7 +161,6 @@ void export_Residue()
     .def("FindAtom", &ResidueHandle::FindAtom, args("atom_name"))
     .def("FindTorsion", &ResidueHandle::FindTorsion)
     .def("GetAtomCount", &ResidueHandle::GetAtomCount)
-    .def("IsValid", &ResidueHandle::IsValid)
     .def("GetBondCount", &ResidueHandle::GetBondCount)
     .add_property("atom_count", &ResidueHandle::GetAtomCount)
     .add_property("index", &ResidueHandle::GetIndex)
@@ -176,7 +177,6 @@ void export_Residue()
     .add_property("phi_torsion", &ResidueHandle::GetPhiTorsion)
     .add_property("psi_torsion", &ResidueHandle::GetPsiTorsion)
     .add_property("omega_torsion", &ResidueHandle::GetOmegaTorsion)
-    .add_property("valid", &ResidueHandle::IsValid) 
     .def("GetGeometricStart", geom_start<ResidueHandle>)
     .def("GetGeometricEnd", geom_end<ResidueHandle>)
     .def(self==self)
diff --git a/modules/mol/base/src/atom_base.hh b/modules/mol/base/src/atom_base.hh
index 55581c8a1684f787c3512e8a17c344654f2367af..a6ddaa7cdae5303b25845ce5fc082f31f75175ab 100644
--- a/modules/mol/base/src/atom_base.hh
+++ b/modules/mol/base/src/atom_base.hh
@@ -48,7 +48,20 @@ class DLLEXPORT_OST_MOL AtomBase: public GenericPropContainer<AtomBase> {
 public:
   AtomBase();
   AtomBase(const impl::AtomImplPtr& impl);
-public:  
+public:
+  /// \name Handle validity
+  //@{
+  /// \brief check validity of handle
+  /// 
+  /// check, whether the bond handle points to a valid atom.
+  /// \note It is an error to use any method other than #IsValid, Impl and 
+  ///       #operator bool() when the handle is invalid. An InvalidHandle
+  ///       exception will be thrown.
+  operator bool() const { return this->IsValid(); }
+  /// \brief check validity of handle
+  /// \sa #operator bool()
+  bool IsValid() const { return Impl().get()!=0; }
+  //@}
   friend class ConstGenericPropContainer<AtomBase>;  
   ///\brief Get atom name. 
   ///
diff --git a/modules/mol/base/src/atom_handle.hh b/modules/mol/base/src/atom_handle.hh
index 04a7eea9464d0141caab2c7af45e3912d525cd3a..83a1c904682d896f6c849faeeea815335a9eac3b 100644
--- a/modules/mol/base/src/atom_handle.hh
+++ b/modules/mol/base/src/atom_handle.hh
@@ -40,20 +40,7 @@ public:
   AtomHandle(const impl::AtomImplPtr& impl);
 
 public:  
-  
-  /// \name Handle validity
-  //@{
-  /// \brief check validity of handle
-  /// 
-  /// check, whether the bond handle points to a valid atom.
-  /// \note It is an error to use any method other than #IsValid, Impl and 
-  ///       #operator bool() when the handle is invalid. An InvalidHandle
-  ///       exception will be thrown.
-  operator bool() const { return this->IsValid(); }
-  /// \brief check validity of handle
-  /// \sa #operator bool()
-  bool IsValid() const { return Impl().get()!=0; }
-  //@}
+
   ResidueHandle GetResidue() const;
   
   EntityHandle GetEntity() const;  
diff --git a/modules/mol/base/src/chain_base.hh b/modules/mol/base/src/chain_base.hh
index 6d4e1317aae946e21c52cedac6a8c3c8eb7272f4..faf7a5c983b7b4e4330cae9b341ee5e6dafadb28 100644
--- a/modules/mol/base/src/chain_base.hh
+++ b/modules/mol/base/src/chain_base.hh
@@ -42,6 +42,20 @@ public: // constructors
   ChainBase();
   ChainBase(const impl::ChainImplPtr& impl);
 public:
+  
+  /// \name Handle validity
+  //@{
+  /// \brief check validity of handle
+  /// 
+  /// check, whether the chain handle points to a valid handle.
+  /// \note It is an error to use any method other than #IsValid, #Impl() and 
+  ///       #operator bool() when the handle is invalid. An InvalidHandle
+  ///       exception will be thrown.
+  operator bool() const { return this->IsValid(); }
+  /// \brief check validity of handle
+  /// \sa #operator bool()
+  bool IsValid() const { return Impl().get()!=0; }
+  //@}
   friend class ConstGenericPropContainer<ChainBase>;
   String GetName() const;
 
diff --git a/modules/mol/base/src/chain_handle.hh b/modules/mol/base/src/chain_handle.hh
index 461176925141b0c327d7facebf412f3e984d3890..1d774dadd2c14d89acadaca430f98875ec7e66db 100644
--- a/modules/mol/base/src/chain_handle.hh
+++ b/modules/mol/base/src/chain_handle.hh
@@ -57,20 +57,7 @@ public:
 
   ChainHandle(const impl::ChainImplPtr& impl);
   
-  /// \name Handle validity
-  //@{
-  /// \brief check validity of handle
-  /// 
-  /// check, whether the chain handle points to a valid handle.
-  /// \note It is an error to use any method other than #IsValid, #Impl() and 
-  ///       #operator bool() when the handle is invalid. An InvalidHandle
-  ///       exception will be thrown.
-  operator bool() const { return this->IsValid(); }
-  /// \brief check validity of handle
-  /// \sa #operator bool()
-  bool IsValid() const { return Impl().get()!=0; }
-  //@}
-  
+
   /// \brief Get parent entity.
   EntityHandle GetEntity() const;
 
diff --git a/modules/mol/base/src/entity_base.hh b/modules/mol/base/src/entity_base.hh
index d68e7df2625505e774fb6c11c0f8693547160b68..7e5c7f2d78d1fd31a532c925775043a88674f0dd 100644
--- a/modules/mol/base/src/entity_base.hh
+++ b/modules/mol/base/src/entity_base.hh
@@ -47,6 +47,19 @@ public:
   void SetName(const String& ent_name);
 
 public:
+  
+  /// \name Handle validity
+  //@{
+  /// \brief check validity of handle
+  /// 
+  /// check, whether the entity handle points to a valid entity.
+  /// \note It is an error to use any method other than #IsValid, #Impl and 
+  ///       #operator bool() when the handle is invalid. An InvalidHandle
+  ///       exception will be thrown.
+  operator bool() const { return this->IsValid(); }
+  /// \brief check validity of handle
+  /// \sa #operator bool()
+  bool IsValid() const { return Impl().get()!=0; }
   impl::EntityImplPtr& Impl();
   const impl::EntityImplPtr& Impl() const;
 protected:
diff --git a/modules/mol/base/src/entity_handle.hh b/modules/mol/base/src/entity_handle.hh
index 7114f54c83627556901779ea7329f3927365d77b..a7d8f887eaf5f4573105c9b39f2ade0d9c240840 100644
--- a/modules/mol/base/src/entity_handle.hh
+++ b/modules/mol/base/src/entity_handle.hh
@@ -64,19 +64,7 @@ public:
   /// default ctor. creates invalid handle.
   EntityHandle();
   
-  
-  /// \name Handle validity
-  //@{
-  /// \brief check validity of handle
-  /// 
-  /// check, whether the entity handle points to a valid entity.
-  /// \note It is an error to use any method other than #IsValid, #Impl and 
-  ///       #operator bool() when the handle is invalid. An InvalidHandle
-  ///       exception will be thrown.
-  operator bool() const { return this->IsValid(); }
-  /// \brief check validity of handle
-  /// \sa #operator bool()
-  bool IsValid() const { return Impl().get()!=0; }
+
   //@}
   /// \brief copy entity, effectively duplicating the whole data structure
   /// 
diff --git a/modules/mol/base/src/residue_base.hh b/modules/mol/base/src/residue_base.hh
index 5b0b556d383c8f49b3ea3819e54f0a71cb283bbd..92901bf9e56a4c10c14260a55fc01577f53d577f 100644
--- a/modules/mol/base/src/residue_base.hh
+++ b/modules/mol/base/src/residue_base.hh
@@ -63,6 +63,19 @@ public:
   ResidueBase(const impl::ResidueImplPtr& impl);
   ResidueBase(const ResidueBase& rhs);
 public:
+  
+  /// \name Handle validity
+  //@{
+  /// \brief check validity of handle
+  ///
+  /// check, whether the residue handle points to a valid residue.
+  /// \note It is an error to use any method other than #IsValid, #Impl and
+  ///       #operator bool() when the handle is invalid. An InvalidHandle
+  ///       exception will be thrown.
+  operator bool() const { return this->IsValid(); }
+  /// \brief check validity of handle
+  /// \sa #operator bool()
+  bool IsValid() const { return Impl().get()!=0; }
   friend class ConstGenericPropContainer<ResidueBase>;
   /// \brief return residue number
   const ResNum& GetNumber() const;
diff --git a/modules/mol/base/src/residue_handle.hh b/modules/mol/base/src/residue_handle.hh
index f280509cc410a5951cc1ad776966905e37e7d7e0..5705f3de8eb6385d8b7397979c4023c421a15c0f 100644
--- a/modules/mol/base/src/residue_handle.hh
+++ b/modules/mol/base/src/residue_handle.hh
@@ -56,18 +56,6 @@ class DLLEXPORT_OST_MOL ResidueHandle : public ResidueBase {
 public:
   ResidueHandle();
 
-  /// \name Handle validity
-  //@{
-  /// \brief check validity of handle
-  ///
-  /// check, whether the residue handle points to a valid residue.
-  /// \note It is an error to use any method other than #IsValid, #Impl and
-  ///       #operator bool() when the handle is invalid. An InvalidHandle
-  ///       exception will be thrown.
-  operator bool() const { return this->IsValid(); }
-  /// \brief check validity of handle
-  /// \sa #operator bool()
-  bool IsValid() const { return Impl().get()!=0; }
   //@}
   ResidueHandle(const impl::ResidueImplPtr& impl)
     : ResidueBase(impl) {}
diff --git a/modules/mol/base/tests/CMakeLists.txt b/modules/mol/base/tests/CMakeLists.txt
index 7d57b01e3e128f793c5204620d65f8057d2e919c..b29f1128e67b23fae8b469437195fb80a40b7cbe 100644
--- a/modules/mol/base/tests/CMakeLists.txt
+++ b/modules/mol/base/tests/CMakeLists.txt
@@ -8,6 +8,7 @@ set(OST_MOL_BASE_UNIT_TESTS
   test_ics.cc
   test_iterators.cc
   test_query.cc
+  test_surface.cc
   test_residue.cc
   test_view.cc
   test_view_op.cc
diff --git a/modules/mol/base/tests/test_chain.cc b/modules/mol/base/tests/test_chain.cc
index 2e42ea77184ab789a659abff5857cef576950f76..f43b9f2fffde39226dcc75ab606d21958a609354 100644
--- a/modules/mol/base/tests/test_chain.cc
+++ b/modules/mol/base/tests/test_chain.cc
@@ -86,6 +86,29 @@ BOOST_AUTO_TEST_CASE(test_comparison)
 }
 
 
+BOOST_AUTO_TEST_CASE(throw_invalid_chain_handle)
+{
+  EntityHandle ent=CreateEntity();
+  ChainHandle chain=ent.FindChain("A");
+  BOOST_CHECK_THROW(CheckHandleValidity(chain), InvalidHandle);
+  XCSEditor edi=ent.EditXCS();
+  edi.InsertChain("A");
+  chain=ent.FindChain("A");
+  BOOST_CHECK_NO_THROW(CheckHandleValidity(chain));
+}
+
+BOOST_AUTO_TEST_CASE(throw_invalid_chain_view)
+{
+  EntityHandle ent=CreateEntity();
+  ChainHandle chain=ent.FindChain("A");
+  ChainView chain_view;
+  BOOST_CHECK_THROW(CheckHandleValidity(chain_view), InvalidHandle);
+  XCSEditor edi=ent.EditXCS();
+  edi.InsertChain("A");
+  EntityView ent_view=ent.CreateFullView();  
+  BOOST_CHECK_NO_THROW(CheckHandleValidity(ent_view.FindChain("A")));
+}
+
 BOOST_AUTO_TEST_CASE(res_pos) 
 {
   EntityHandle eh=CreateEntity();
diff --git a/modules/mol/base/tests/test_entity.cc b/modules/mol/base/tests/test_entity.cc
index ac262c406cc7620febc688ef57237ad646f879c4..f4fb9ca01e2dd478c056fe197b6955593692c773 100644
--- a/modules/mol/base/tests/test_entity.cc
+++ b/modules/mol/base/tests/test_entity.cc
@@ -75,12 +75,29 @@ EntityHandle make_test_entity()
   res2.SetChemClass(ChemClass(ChemClass::LPeptideLinking));  
   e.AddTorsion("PHI", res1.FindAtom("C"), res2.FindAtom("N"), 
                res2.FindAtom("CA"), res2.FindAtom("C"));
-               
   return eh;
 }
 
 BOOST_AUTO_TEST_SUITE( mol_base )
 
+
+BOOST_AUTO_TEST_CASE(throw_invalid_ent_handle)
+{
+  EntityHandle ent;
+  BOOST_CHECK_THROW(CheckHandleValidity(ent), InvalidHandle);  
+  ent=CreateEntity();
+  BOOST_CHECK_NO_THROW(CheckHandleValidity(ent));
+}
+
+BOOST_AUTO_TEST_CASE(throw_invalid_ent_view)
+{
+  EntityView ent_view;
+  BOOST_CHECK_THROW(CheckHandleValidity(ent_view), InvalidHandle);  
+  EntityHandle ent=CreateEntity();
+  BOOST_CHECK_NO_THROW(CheckHandleValidity(ent.CreateFullView()));
+  BOOST_CHECK_NO_THROW(CheckHandleValidity(ent.CreateEmptyView()));
+}
+
 BOOST_AUTO_TEST_CASE(entity_creator) 
 {
   EntityHandle eh = CreateEntity();
diff --git a/modules/mol/base/tests/test_residue.cc b/modules/mol/base/tests/test_residue.cc
index d6cc11f4a447e4d62a0a2f82f867f3173e18f8b3..f622f72a56a069e911321842268fedafb19181b8 100644
--- a/modules/mol/base/tests/test_residue.cc
+++ b/modules/mol/base/tests/test_residue.cc
@@ -45,6 +45,34 @@ BOOST_AUTO_TEST_CASE(test_in_sequence)
   BOOST_CHECK(!InSequence(rA,rC));
 }
 
+
+BOOST_AUTO_TEST_CASE(throw_invalid_res_handle)
+{
+  ChainHandle chain;
+  EntityHandle ent=CreateEntity();
+  XCSEditor edi=ent.EditXCS();
+  chain=edi.InsertChain("A");
+  ResidueHandle res=chain.FindResidue(ResNum(1));
+  BOOST_CHECK_THROW(CheckHandleValidity(res), InvalidHandle);
+  edi.AppendResidue(chain, "GLY");
+  res=chain.FindResidue(ResNum(1));
+  BOOST_CHECK_NO_THROW(CheckHandleValidity(res));
+}
+
+BOOST_AUTO_TEST_CASE(throw_invalid_res_view)
+{
+  ChainHandle chain;
+  EntityHandle ent=CreateEntity();
+  XCSEditor edi=ent.EditXCS();
+  chain=edi.InsertChain("A");
+  ResidueView res;
+  BOOST_CHECK_THROW(CheckHandleValidity(res), InvalidHandle);
+  edi.AppendResidue(chain, "GLY");
+  EntityView ent_view=ent.CreateFullView();
+  res=ent_view.FindChain("A").FindResidue(1);
+  BOOST_CHECK_NO_THROW(CheckHandleValidity(res));
+}
+
 BOOST_AUTO_TEST_CASE(test_res_index)
 {
   EntityHandle eh=CreateEntity();
diff --git a/modules/mol/base/tests/test_surface.cc b/modules/mol/base/tests/test_surface.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6e30dcd07af14434fabaafdbd2e7e16c0fbf5ed0
--- /dev/null
+++ b/modules/mol/base/tests/test_surface.cc
@@ -0,0 +1,40 @@
+//------------------------------------------------------------------------------
+// This file is part of the OpenStructure project <www.openstructure.org>
+//
+// Copyright (C) 2008-2010 by the OpenStructure authors
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License as published by the Free
+// Software Foundation; either version 3.0 of the License, or (at your option)
+// any later version.
+// This library is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+// FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+// details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this library; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+//------------------------------------------------------------------------------
+ 
+#include <ost/mol/surface_handle.hh>
+#include <cmath>
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+
+using namespace ost;
+using namespace ost::mol;
+
+BOOST_AUTO_TEST_SUITE( mol_base )
+
+
+BOOST_AUTO_TEST_CASE(test_throw_invalid_surface)
+{
+  SurfaceHandle surf;
+  BOOST_CHECK_THROW(CheckHandleValidity(surf), InvalidHandle);
+  
+  surf=CreateSurface();
+  BOOST_CHECK_NO_THROW(CheckHandleValidity(surf));
+}
+
+BOOST_AUTO_TEST_SUITE_END()
diff --git a/modules/seq/base/tests/test_alignment.cc b/modules/seq/base/tests/test_alignment.cc
index 516c966a487dc92979034befd7f89ec12a994f81..b4ee98a40f8cb53fd92b2d749d0e121e45e81b3c 100644
--- a/modules/seq/base/tests/test_alignment.cc
+++ b/modules/seq/base/tests/test_alignment.cc
@@ -74,6 +74,15 @@ BOOST_AUTO_TEST_CASE(alignment_triv)
   BOOST_CHECK_NO_THROW(AlignmentFromSequenceList(list));
 }
 
+BOOST_AUTO_TEST_CASE(aln_throw_invalid)
+{
+  AlignmentHandle s;
+  BOOST_CHECK_THROW(CheckHandleValidity(s), InvalidHandle);
+  s=CreateAlignment();
+  BOOST_CHECK_NO_THROW(CheckHandleValidity(s));
+}
+
+
 BOOST_AUTO_TEST_CASE(alignment_count_and_length)
 {
   AlignmentHandle a = CreateAlignment();
diff --git a/modules/seq/base/tests/test_sequence.cc b/modules/seq/base/tests/test_sequence.cc
index 264a902ea81455dcdeb994893536d24c9c9f9455..d628e14dd9c5ec10df82817c864f68bcc097dbd7 100644
--- a/modules/seq/base/tests/test_sequence.cc
+++ b/modules/seq/base/tests/test_sequence.cc
@@ -65,6 +65,14 @@ BOOST_AUTO_TEST_CASE(seq_triv)
   BOOST_CHECK_THROW(s.SetString("1"), InvalidSequence);
 }
 
+BOOST_AUTO_TEST_CASE(seq_throw_invalid)
+{
+  SequenceHandle s;
+  BOOST_CHECK_THROW(CheckHandleValidity(s), InvalidHandle);
+  s=CreateSequence("A", "abcd");
+  BOOST_CHECK_NO_THROW(CheckHandleValidity(s));
+}
+
 BOOST_AUTO_TEST_CASE(seq_length)
 {
   SequenceHandle s=CreateSequence("S1", "abfcdadeaf");