some undef fixes
removed unneeded if