Design hint: Test the 2nd repeat reference for moving back and deleting a case in the first repeat. The references might get mixed-up.
See
- Reduction of dynamic repeat_count creates crash in Enketo/Preview (pages style)
- Cases not removed after repeat_count was reduced (KoBoCollect)
- Repeat_count creates a wrong value for first case (Enketo/Preview).
You may need to control this by packing the content in the second repeat in a group controled by a relevant.