Fix replicate.db script

With help from @alexmuller, fix replicate script after being moved by @robyoung