fixed null pointer issue