Fix spurious "too late to set encoding" errors.