Partial revert of 7675611e5f8b89e5e304acceaa645879b45111e1 to fix AMD
issues