Fixes #6985

Second attempt, it should be fine now.
Fixes #6985