adoptation to Python 3