Fix wrong reference to undefined property when creating new trees.
Refactoring :p