Fix bug undoing invalid trim operation.