fix client null pointer issue