BUG: fixed bugs when running in Python 2.6