My dog is wary of children. Especially small, screamy, spazzy children. So when you allowed your toddler to scream, "Bark, bark, bark, bark, bark, bark!" in his face on the public sidewalk, it pretty much confirmed his feelings of wariness. Next time this happens ('cause I'm sure it happens a lot) I suggest you do some hands-on parenting to diffuse the situation, rather than standing there grinning like an idiot.