partial revert of 4b69a348