We should use the check `typeof x ==='undefined'` here and throughout.