Replacing truncated file