some adaptions to python 3