bugfix for #18493

check if exists  not just if null