temp patch of #281 while waiting on wavesurfer's latest version #325 and bug fixes