better undefined check