Undisclosed principal

I came across this in Ninja notes. Liability when acting for an Undisclosed Principal o Agent liable to third party even if acting within authority o Third party can sue both Principal and Agent if Principal becomes disclosed o Agent can then sue Principal How does this make sense? Hey, I know who you're working an agent for, so I'm going to sue you now?