Fixed messed up search-and-replace side effects