Fixed replace code