We can deal with this annoying bug by looking out for the error we see when it happens, hitting the 'refresh' button again, and resetting the loop counter to 1 (requires changing the loop to a C-style loop).