python 3 and 2.5 fixes