resolves #1035 allow Treeprocessor to return replacement tree