avoid query empty list in db