=remove bogus lines and fix replicate