since it's possible to reuse the ui object (see 6772a32edec7)
between dispatch calls, the ui might have been wrapped already.
we could probably move this test up a bit but leaving it here
allows updates to take effect by extstyles() and configstyles().
Without this fix, any calls to write_err would go to stdout instead of
stderr, and calls during pushbuffer would cause unpack ValueErrors on
popbuffer.