Fix up some countWritten (and friends) calculations.