fixed undefine  variable issue