is in their custody; or, if the child is or was a recipient of any type of public assistance, by the IV-D agency as set forth in chapter 119A on behalf of the department of transitional assistance, the department of social services, the division of medical assistance or any other public assistance program of the commonwealth; provided, however, that if the mother of the child was or is married and