fixed issue with saving wave to a file