fixed logic when checking whether waveform generation is needed