Automatic detection of offsets on file open