fixed encoding errors for py3