fixed replication (backport pr #175 to 0.9.x)