fix incorrect null check