Iterator referencing issues