correct string handling to support py3 again