Bug fix for multiple replacements not working