Fixed error when destroying leaves.