Fix: replace-all now handles the case where new string contains the old one as a substring

This led to infinite loop.