fixes a bug in internalCopy that made appendScratchpad produce corrupted trees
Merge pull request #5 from xeno-by/master

fixes a bug in internalCopy that made appendScratchpad produce corrupted trees