Fixed some python3 issues. Encode/decode strings. Tested w/ python2 and python3