Fixes #14566 (cherry picked from commit c1566ef0) (cherry picked from commit b7f2308b) (cherry picked from commit 49e7c3b6)