Fix wrong local spec.
Fix typo/logic problems in the treatment of local optimizations that apply to all nodes.