Fixed wave Header creation code to work properly.