Fixed the problem where a new tree had to be created always