fixed replace bug