Fixed an infinite loop when trying to deepen a shallow clone.