Fixed Python error on using an iterator instead of a list.