Proper setting of sys.stderr and sys.stdout