Fix regression in search and replace