bugfix in wave.c