Fix in checksum calculation condition

The original code treats last chunk as first one and hence calculates the magic vector also in the last chunk.