Might be interesting for us to know about the side effects, maybe we have other things to fix!
Anyway, I created a PR with a proposed fix. Needs some review on this though as I'm not very familiar with this area of the code.