Partial revert of ec7202102e6fe1f3541700b09b819485239e01db