handle undef error