From your description, he wasn't comfortable with the hug and barked. When your niece screamed and ran he chased and bit in the butt.
This should have never happened. He is a young dog that was over-stimulated, and then the kids were not taught to be respectful of the puppy and the owner did not put the pup up when things were chaotic and the day was already enough. That which runs must be chased, amped up from all the kids, the hubub and the playing/river, and then he gets hugged and communicates that isn't ok, and then he reacts to the girl's reaction.
I have little tolerance for dogs who bite kids. On the other hand, all animals have limits. In the end, this is up to you, the owner. There are dogs that would not have bitten with that set of circumstances. And others would have bitten the child when she hugged him.
He is young, just growing into his adult temperament. It can get worse, or he can get better, or you can get a lot better at managing him around kids, and putting him up after enough interaction.
Jenna, RN CGC & Babs, CD RA CGC HIC
Heidi, RA CGC
SG3 Odessa, SchH1, Kkl1, AD
Ninja, RN CGC & Milla, RN CGC
Joy, Star Puppy, RN CGC
Dolly CGC & Bear CGC