fix bug in search_resource fn