try tounicode instead of tostring to avoid problems with python 3