Fixed from py3 incompatibilities.