fixes problems with replacement 3