Repair search&replace function

Hello, I did some corrections concerning the search&replace function.