Fixed comparison with "undefined"