improve compatibility with python2.5