null pointer cookie fix
Minor tweaks to the base context code