add detection of truncated and rewritten files - if file size is
smaller than stored offset, reread from beginning