Fixed bug causing iterator to restart incorrectly at rewind on second foreach refs #69