Fix inconsistent top and bottom arrays on restoration

- fixes #52
Merge pull request #53 from zeebox/array-index-out-of-bounds

Merged pull request #53 - Fix inconsistent top and bottom arrays on restoration