Context null check

This is a unit test that reproduces the problem we were seeing, a fix to make the test pass, as well as a fix to another unit test that broke locally that seems to be related to the Contexts change.