Fix exception for python3