Fixes for python 2.4 compatibility

The only problems I found when using the 3.1.1 release were in util.py and were easily fixed up.