Properly check of undefined