Fixes #4649

Fixes https://github.com/Baystation12/Baystation12/issues/4649.

Redo of the previous bad PR. Good thing for git cherry-pick.