Fix an issue where required fields weren't being written.