fix the null pointer issue;