Fix null pointer issue.