python3 iterator fix