Fixed python2.6 bugs