Fixed null pointer issue.