Fix tests and duplicate submission handling