Fix iterator issue in Python 3.3