fixed iterator for php 5.5