clean up weird loop in generator