Bugfix, improved logging

Fixed the way the number of blocks to be saved/read is calculated, as it did
not take into account the offset of the range relative to block boundaries.