fix list iteration problem