modified to support python2.6
merge