Fixed condition to check for undefined value