Fix python3 compatibility issue