Fix doctest:test bugs

Fixes Assembla ticket 150. Review by @cvogt