Fixes to the term tree