fix if condition checking for an empty value