Revert "Work around bug 3507"

This reverts commit 566211aea97fb4c3e33de880fbba50c0851e2564.
Revert "Work around bug 3539"

This reverts commit 5b62c0217e4a6d93a1371e5cb5c7ef709d619097.