Call rewind() before using any iterator

To prevent possible issues like #298 in the future, call rewind() before using any iterator.

This is not necessary for the iterators using a foreach loop: http://www.php.net/manual/en/iterator.rewind.php.