diff --git a/modules/mol/base/doc/editors.rst b/modules/mol/base/doc/editors.rst
index 02a97514e031ae20bec4da90e822e70967290c32..71bcae0a9f72024250232db41f31d009c847c5e6 100644
--- a/modules/mol/base/doc/editors.rst
+++ b/modules/mol/base/doc/editors.rst
@@ -85,8 +85,8 @@ The basic functionality of editors is implemented in the EditorBase class.
      identifiers. If new_name is already in use by any chain, an exception will
      be generated.
 
-     :param chain:  Must be a valid chain
-     :type residue:   :class:`ChainHandle`
+     :param chain:    Must be a valid chain
+     :type chain:     :class:`ChainHandle`
      :param new_name: is the new name
      :type new_name:  string
 
@@ -196,8 +196,8 @@ The basic functionality of editors is implemented in the EditorBase class.
 
      Change the name of atom to new_name without changing anything else.
 
-     :param residue:  Must be a valid atom
-     :type residue:   :class:`AtomHandle`
+     :param atom:     Must be a valid atom
+     :type atom:      :class:`AtomHandle`
      :param new_name: is the new name. Free to choose and not verified to be a
                       valid atom identifier.
      :type new_name:  string
diff --git a/modules/mol/base/src/impl/entity_impl.cc b/modules/mol/base/src/impl/entity_impl.cc
index 58d2bce06a01c2240904c043b591b7608bb13bbf..26709b43130b4119502ccc41a3d7d2af8814d9c2 100644
--- a/modules/mol/base/src/impl/entity_impl.cc
+++ b/modules/mol/base/src/impl/entity_impl.cc
@@ -1177,9 +1177,9 @@ pointer_it<ChainImplPtr> EntityImpl::GetChainIter(const String& name)
 
 void EntityImpl::RenameChain(ChainImplPtr chain, const String& new_name)
 {
-  ChainImplList::iterator i;
+  //ChainImplList::iterator i;
   ChainImplPtr  ch=this->FindChain(new_name);
-  if (ch) {
+  if ((ch) && (ch != chain)) {
     throw IntegrityError("unable to rename chain '"+chain->GetName()+
                          "' to '"+new_name+"', since there is already a chain "
                          "with that name");
diff --git a/modules/mol/base/tests/test_chain.cc b/modules/mol/base/tests/test_chain.cc
index a0fd47ba34a1c2d1e8ce3099faa4c0004b09347b..a2bdda81f87a8fb3b703a5489b232e8bd0ae00eb 100644
--- a/modules/mol/base/tests/test_chain.cc
+++ b/modules/mol/base/tests/test_chain.cc
@@ -21,6 +21,7 @@
  */
 #include <ost/mol/mol.hh>
 #include <ost/message.hh>
+#include <ost/integrity_error.hh>
 #define BOOST_TEST_DYN_LINK
 #include <boost/test/unit_test.hpp>
 
@@ -192,8 +193,13 @@ BOOST_AUTO_TEST_CASE(rename_chain)
    EntityHandle eh=CreateEntity();
    XCSEditor e=eh.EditXCS();
    ChainHandle ch1=e.InsertChain("A");
-   e.RenameChain(ch1, "B");
-   BOOST_CHECK_EQUAL(ch1.GetName(), "B");
+   ChainHandle ch2=e.InsertChain("B");
+   e.RenameChain(ch1, "A"); // renaming chain with its current name should work
+   BOOST_CHECK_EQUAL(ch1.GetName(), "A");
+   BOOST_CHECK_THROW(e.RenameChain(ch1, "B"), IntegrityError);
+   e.RenameChain(ch2, "C");
+   BOOST_CHECK_EQUAL(ch2.GetName(), "C");
+   BOOST_CHECK_EQUAL(eh.GetChainCount(), 2);
 }
 
 BOOST_AUTO_TEST_SUITE_END()