Correctly set attributes when removing args during cloning. Fixes PR2765