Fix NPEs in YMLSerializer.