Fixes #14566 (cherry picked from commit c1566ef0)
mentioned in commit e641811c
mentioned in commit 49e7c3b6