Python 3.4 and fixes for doctests

This replaces #314.