fix compatibility with python2.6
fix syntax error