bug fix in leaf iterator