Fixing 'undefined' value comparison, 'typeof' was added