Fixed a null pointer bug 
Fixed a context bug