check tree balance