adding NULL check