Fixed null reference error handling category context activities

unit tests pass.