fix undef function