Makes undefined check more error-proof