Fix encoding of NULL values to typed fields.