Fix #8516

I can't actually reproduce this on my system, but I think this should fix it.