don't use typeof for undefined checks