check against null instead of undefined