Fixed bug in calculating blocks in certain arrangements