diff --git a/src/xercesc/dom/DocumentImpl.cpp b/src/xercesc/dom/DocumentImpl.cpp
index dd48df35ab6dd7011bdb2a044236d43ebbb9b9db..9356a3c1f9d881208dd750d19173c0d257fc6fe7 100644
--- a/src/xercesc/dom/DocumentImpl.cpp
+++ b/src/xercesc/dom/DocumentImpl.cpp
@@ -593,7 +593,7 @@ NodeImpl *DocumentImpl::importNode(NodeImpl *source, bool deep)
             newentity->setNotationName(srcentity->getNotationName());
             // Kids carry additional value
             newnode=newentity;
-            newentity->isReadOnly(false);// allow deep import temporarily
+            newentity->setReadOnly(false, true);// allow deep import temporarily
         }
         break;
     case DOM_Node::PROCESSING_INSTRUCTION_NODE :
@@ -662,8 +662,8 @@ NodeImpl *DocumentImpl::importNode(NodeImpl *source, bool deep)
             newnode->appendChild(importNode(srckid, true));
         }
     if (newnode->getNodeType() == DOM_Node::ENTITY_REFERENCE_NODE
-        || newnode->getNodeType() == DOM_Node::ENTITY_REFERENCE_NODE)
-	newnode->isReadOnly(true);
+        || newnode->getNodeType() == DOM_Node::ENTITY_NODE)
+         ((EntityReferenceImpl*)newnode)->setReadOnly(true, true);
 
     return newnode;
 };
diff --git a/src/xercesc/idom/IDDocumentImpl.cpp b/src/xercesc/idom/IDDocumentImpl.cpp
index 4f70f6f06e060838d34b0e9545f10c2df77bcaf4..a725a49c5ff9571f2ea92109cf1b431968f881c9 100644
--- a/src/xercesc/idom/IDDocumentImpl.cpp
+++ b/src/xercesc/idom/IDDocumentImpl.cpp
@@ -567,7 +567,7 @@ IDOM_Node *IDDocumentImpl::importNode(IDOM_Node *source, bool deep)
             newentity->setNotationName(srcentity->getNotationName());
             // Kids carry additional value
             newnode=newentity;
-            castToNodeImpl(newentity)->isReadOnly(false);// allow deep import temporarily
+            castToNodeImpl(newentity)->setReadOnly(false, true);// allow deep import temporarily
         }
         break;
     case IDOM_Node::PROCESSING_INSTRUCTION_NODE :
@@ -636,8 +636,8 @@ IDOM_Node *IDDocumentImpl::importNode(IDOM_Node *source, bool deep)
             newnode->appendChild(importNode(srckid, true));
         }
         if (newnode->getNodeType() == IDOM_Node::ENTITY_REFERENCE_NODE
-            || newnode->getNodeType() == IDOM_Node::ENTITY_REFERENCE_NODE)
-            castToNodeImpl(newnode)->isReadOnly(true);
+            || newnode->getNodeType() == IDOM_Node::ENTITY_NODE)
+            castToNodeImpl(newnode)->setReadOnly(true, true);
 
         return newnode;
 }