before writing into the file