fixing null ptr