Fix various error handling conditions on the cell overwrite optimization.