Steps towards Python3 compatibility