Fix context bugs