Fixed replication if statement