fix for cursor object not being iterable more than once