isLeaf method