added write_at for stream