core: fix main loop generation