some null pointer checks