search and replace bug