Fix cases where we generated horrible code like this: