When your error occurs check the variables and the subitems value to see what they are at the time of the error and maybe that will help.
I did that hundred of times already ))))
So what was the results?
When I click slowly on newly added listitem, everything is working fine. If I do that faster, I get error on line 231.
I know the error occurs on that line and I know it is because the query returns no result. What I do not know is what the value of those variables are at the time the error occurs which is what I was referring to when I asked what were the results. Which of course I still do not have an answer.