When the boys return to St. Petersburg, most of the parents are happy to see their children and Tom worries about the fact that no one is waiting for Huck.
Tom, Huck, and friends are out camping when a terrible storm hits. They are pretending to be pirates, but piracy loses its attraction when you're soaking wet and hungry.
Tom and Huck were thought dead, until they arrived at their own funeral. They snuck in and hid in the back of the church to see what was going on, as their lives were celebrated—mostly Tom’s of course—but not Huck’s.
Aunt Polly, Mary, and the Harpers threw themselves upon their restored ones, smothered them with kisses and poured out thanksgivings, while poor Huck stood abashed and uncomfortable, not knowing exactly what to do or where to hide from so many unwelcoming eyes. (Ch. 17)
Tom notices that no one is glad to see Huck, and it makes him feel bad. Tom tells his Aunt Polly, and Polly showers Huck with gratitude. At this point there is a great celebration in the town, and it goes on all day. The children are safe, and everything is well again.
This incident demonstrates that while Tom can be selfish and silly, he also has a big heart. He feels for Huck when he realizes that he doesn't have anyone to mourn for him, and even though it makes Huck uncomfortable, he includes him in the festivities.