replaced instances of str() with .encode('utf-8')