fix a context bug, improve documentation