Fix replication bugs that dropped some messages due to parsing