change cast to null chk (Coverity)