DDF-236: Added some null checks based on code review