fixed search function. unit test still not working properly