Add functional test to show more complicated let node nesting
Fix infinite loop caused by adding identical let nodes to the same tree