Fixed issue when writing a field and the value is null.