Fix bugs in clone