Continuity mistake: In the shot after Mai says "Saving the jerk who dumped me" you can see the rods which the prison guards used to slow down the mechanism of the gondola are nowhere near the wheel. (00:19:55)
Continuity mistake: When Azula says: "What is she doing?" Ty Lee is standing behind her. When the shot cuts and Ty Lee shrugs, they are standing side by side,. (00:20:30)
Answer: The pirates are from the episodes "The Waterbending Scroll" and "The Waterbending Master" (They're the ones Katara stole the scroll from). The traveling musicians are from "The Cave of Two Lovers. The prisoners of war likely refer to the Kyoshi Warriors, the men of the Southern Water Tribe, and possibly Bumi and the other citizens of Omashu.