added toString check and fixed context bug