Fixes #8420 and some clang errors.