This assumption is wrong if `offset >= N * PAGE_SIZE` and `offset + length < (N+1) * PAGE_SIZE`. I think the only way to fix it would be to make ByteArray.get return a boolean which can be used to know whether a copy has already been performed.