fixed search with name, TODO: refactor!