Fixed compatibility of __str__ with py3