Make code compatible to python2.6.