Fixed bug in PyObject iteration