fix a null pointer issue