tree balancing check