A bunch of more little fixed for Python 2 compatibility