Make finding the CSP more resiliant.  Fixes #8432.