Minor chnage in file writing