replaced hardcoded "UNDEF" string with variable