fixed bug in iterator