Add FileId header and switch fileid and instance id

fixes #3593

@dragotin