Fix botched port of StringIO#putc and remove hack from write.