Fix reference foreach
Prepare replace of iterator
Compatible iterator handling with references