fix output stream