fixing some issues with Python 2.5 syntax that was caught with --with-doctests with turned on