fixed isWood/isLeaves code to be safer