fixed the defer in Search