Fixing a tree copy bug.
Merge branch 'master' into beam-dev