Fix replication setup

various fixes that fix the setup of replication and startup of the plugin