undef variable fix