fix bugs in replicated message