Adaptions for python3.