fix search and add functionality