refactor WriteField