[Bugfix] check for context parameter

Check for existence of context parameter before getting it.