Fix a regression introduced by e14ff38a54e1d890bdf03f155204b7b78b8515d3. Fixes #8904.