fixed context bugs