null ptr issue fix