Fix basic python 2/3 incompatibilities.