Hacks to make it work on Python 2.5