fixed a replace bug when using 'x' in arithmetic string