adapt to Py3