Fix infinite loop on run_next_action