Add checking to make sure sections and rows are large enough for indexes. Fixes #400.