fix up predicate search logic bug
and also make sure we don't base a search off a nil element