Fix #8516
Merge pull request #8520 from JuliaLang/sjk/8516

Fix #8516