Fix python3 compatibility