fixed problem where cursor stops after 10k results

The StopIteration exception was raised before the last set of results were yielded.