complete modify file function