Fixed control logic for run/stop loop