write.c: compaction bug fix