fixing code for obtaining long waveforms

fixing code for obtaining long waveforms