Minor fix to loop_gen.py to avoid jumping to other pages.