Fixes #17451, while also keeping the Dante performance fix from #17032. Of course, it's possible that something else could slow down now... But hopefully not. This could also fix other problems.