fixing null and undefined lookup, fixes #397

Issue #397.
Wow, that's poetry.