Restore the correct main loop