fix output encoding when streaming