[queue] [fix] Check correctly-scoped error when deciding to repeat
[queue] [minor] Call modify if i is less than 0, not only when equal