some null checks from coverity