fix typeof undefined checks; typeof always returns strings

    typeof foo !== undefined

Will always return false because typeof returns strings, ie `"undefined"`