stream: fix write callback