fixing undef bug