Fix Py3 range incompatibilities