let's fix this atrocious memory leak in the replication.