Fixes for Python 2.5 and Python 3.2 support