Fixed bugs in indexing for block ordering.