Fixed bug with iterator