BUG: fix encoding issue in py3