FIX bug on method isLeaf