Variety of Py2 compatibility changes