better fix for python 3 string encoding problems