Run the DNA on all the confused kids. If XY, then male. If XX, then female. Very precise. No more confusion.
Is there a judge with the sense to make such a ruling?