Fixed a bug caused replace error.