fix output encoding