averaging a list of waves code is explicit

encountered a strange bug where the wave list averaging was failing on a
list and creating an incorrect result (worse than creating no result at
all!). rewrote the function to make the mean algorithm explicit in the code
and now things work. don't know where the bug was, but it is gone now in any
event.