Fix pkgin search

This supersedes #3639