A gait modulation system including: (a) a sensor device including a sensor adapted for associating with at least one lower limb of the patient, the sensor for transducing at least one parameter related to a gait of the patient, so as to obtain gait data related to the gait, and (b) a muscle stimulator including: (i) an electrical stimulation circuit, the circuit adapted to supply an electrical stimulation output to an electrode array for performing functional electrical stimulation of at least one muscle of the lower limb, and (ii) a microprocessor, operatively connected to the at least one sensor, the microprocessor adapted for: receiving a stream of gait information based on the gait data; processing the gait information, and controlling the stimulation output based on the processing of the gait information, and wherein the microprocessor is further adapted to identify a failure in the stream of gait information, and to consequently control the electrical stimulation circuit to deliver a fail-safe stimulation output over a portion of a duration of the failure.