writer: fix off-by-one.