As the state prepares to count ballots in the contentious party primaries for his replacement, Gov. Rick Scott named two interim heads for the Department of Juvenile Justice and the Department of Children and Families Tuesday.

Timothy Niermann, the deputy secretary at the Department of Juvenile Justice, will temporarily take over the agency when current head Christina Daly leaves at the end of the month. Before becoming deputy secretary in December 2015, Niermann was the assistant secretary for probation and intervention services and central regional director for probation and community intervention. According to the announcement from the governor's office, he has worked for in state government for 40 years.

Rebecca Kapusta, the current assistant secretary for operations at the Department of Children and Families, will take over as the agency's interim secretary. She was the department's general counsel until late last year and was also a general magistrate in the Twelfth Judicial Circuit, according to the governor's office. Scott announced earlier this month that Mike Carroll, the current DCF secretary, is resigning effective Sept. 6.

Both agencies have been long troubled by controversy. Under Daly's tenure at the Department of Juvenile Justice, the agency expanded efforts to divert non-violent youth into treatment and community services, rather than brick-and-mortar facilities. But her time was also marked by abuses in those facilities and questionable deaths of youths in the state's care. Carroll's four-year stint at the Department of Children and Families was also the subject of several high-profile youth deaths, particularly those involving the abuse of vulnerable children.

It was unclear when or if Scott, who is nearing the end of his second term, intends to name permanent replacements.

Miami Herald staff writer Carol Marbin Miller contributed to this report.