Fix bugs in buffer erasing cells and calculating damage.