Issue with data update to the correct record

well, you set a counter (110), every batch you subtract 50, you check every time if the remainder is still >= 50, and if not the last batch size is the remainder (10).