This commit reverts c9561f0 and 69a8c0d and effectivly fixes gh-8979 but reintroduces the issue reported in gh-8495.
c9561f0
69a8c0d