some null pointers fixed