Fix generator loop