add deep cloning to documents

Fix for issue #85