Fixing encode/decode issues in Python 3.x.