main loop protection updated