Partial revert of 0435ec5034ca33bae29944ea819c6d3db251dc01

It turns out part of that hack was necessary.