Merge "Fix crash due to inconsistent handling of CR" into main