Fix incorrect undefined check