waveform.js: fix the scope of some values