minor change to undefined check