fix context bugs