Un-revert commits added to test Travis CI failures
Fix doctest which causes side-effects.

I'm not sure that there's a safe way to write this example as a doctest,
but I think this will pass on Travis (although it still has side-effects.