fixing a few null pointers

fixing a few null pointers