avoided some null pointers