Fix a bug with blockIndex