Fixed bug in waveform generator.
Fixed bug in discontinuous mode.