fixed m replacement when special characters are used