Fix an NPE in tree manager