don't add subtree of a document to parent document and small performance improvement