Fix write_pcm method.