Update code and tests to run under python2.6