Fix iterate with optimal sharing