Fix __str__ typeerror in Python 3