fixed iteration on py3