Fix handling of empty lookup/list result
Unit test for empty lookup/list result