Fixes to use qualified selectors and undefined

Fixes to use qualified selectors and check undefined value