pmap: Fix lookup function and add test for it