Added undef check