Fix undefined handling for pathed lookups

Fixes #837