Welcome to Healthcaremagic.
The stool problem could be related to the teething
I would ask you to get his genitals examined in detail by a pediatric surgeon as some of the congenital conditions can present this way.
Also give him enough amount of water which helps both stool and the genital problem.
Wish you god health.