Use getFieldAs to properly convert values in writers.

close #296