fixed a bunch of context bugs