changed !==null to typeof undefined (missed this one)