avoid null ptr exception