Fix bug #21280. Thanks to John Darrington for review.