revert a few bits of 6c723a0d3