Fixing bug when replacement was not deep copied that caused the replacement to become fixed on the first result