fixed bug in WaveWriter