Fix Python 3 incompatibility