Here is a patch inverting (1) and (2) above.