Fix a bunch of context bugs