Fix python3 data encoding