Add back dependency check and correct null category issue.