fixed handling of undefined and falsy values