Add missing undefined check