VE-821: Fix incorrect comparision against "undefined", also minor cleanu...

...p to variables name.