inverse the search order, is not fast but working