fixes #327

Someday this iterator stuff will all be rewritten to be more sane...