Fix EE and the logic in the tree impl