Py3 and Py2.5 compatibility fixes