Correct the mistakes in the logic of _get_block_entry_index.
* The exit condition compared all the tuple, rather than the first part,
so it would always trigger.
* The wrong variable was incremented, so it would infinite loop if it wasn't
for the above mistake.