py3: fix string IO
py2: fix nonetype comparison
py3: remove extra decode