doctest bugfixes for python 3