fix replicate bug