More conversion to python3 compatible code