copyDBalgorithm and minor fixes