Maybe replace these with writeOptionalString as well while you are at it