Fixed the tree view handling for when it is not activated or hidden