fixing generating toString bug