Partial revert to #3116