Fixes to make it work with Python 3

* Added import for json (Python3)
* Fix Byte - String encoding (Python3)