Python 2.6 fixes

Makes the code compliant with Python 2.6 once again.