Revert modification from upstream and convert it to dpatch