some type checking in search()