Fix the case where search is nil