Bug fix in tree method