Fix Python 3 problems