Python 2.4 repair

Python 2.4 fixes for 1.7 stable.