Fixed the order of text replacements

Proper order is necessary to do the intended text replacements.