fix streaming and buffer issue