fix bug about controll of the number of nodes of tree