consistently getting StopIteration bug