In your code snippet I see that your delete form is nested inside the update form. I assume that sometimes the wrong form gets triggered and that is causing the issue.
In the w3 docs you can read the following: "Note you are not allowed to nest FORM elements!"