More adaptions for Python 3.