Fixes for the cloneDatabase() function