Fix clone when first changeset is rename

There are two fixes: first o fix a bug, ans second to improve performance.