Fix py3k incompatibilities