Make select_block_grid_sizes() more robust.