Fix category check's and add null check for node.