Sanity check index numbers when reading channels

This check is good in general, but it is being added specifically
to detect cases where the response read from the scanner is out of
sync with the query. This can happen if, for example, another
program is also querying the scanner while a read is in progress.

Note that, in that case, the current behavior of retrying the query
may actually prolong the problem (keeping the responses out of sync),
but it is still possible to recover from it. The most important thing
is detecting when the data is corrupt, and not using it in that case
(and showing an error message).