also use new `writeDoubleArray` here