kludge around broken TextIOWrapper