Added compatibility code for python2.6