Fix the behavior of the default print destination

Ie if you override sys.stdout, prints without an explicit destination
will go to the new location.

Also sneak in a couple other bugfixes.