Added some null argument checks in mission critical code