Fix StopInteration Bug